XSL ±âÃÊ

1. XSL ±¸Á¶

2. XSLT ÀÌÇØ(1)

3. XSLT ÀÌÇØ(2)

4. XPath ÀÌÇØ

5. XSL Stylesheet ¿¹Á¦ (1)

6. XSL Stylesheet ¿¹Á¦ (2)

7. XSL Stylesheet ¿¹Á¦ (3)

8. XSL Stylesheet ¿¹Á¦ (4)

1. XSL ±¸Á¶

µé¾î °¡±â¿¡ ¾Õ¼­..

XMLÀÌ ÀÎÅͳݻóÀÇ µ¥ÀÌÅÍ Àü¼ÛÀ» À§ÇØ ¼³°èµÇ¾ú´Ù¸é, XSLÀº ÀÌ·¯ÇÑ XML¹®¼­¸¦ ó¸®Çϱâ À§ÇØ ¼³°èµÇ¾ú´Ù. XSLÀº XMLÀÇ ÀåÁ¡ÀÎ Ç÷§Æû µ¶¸³ÀûÀ̰í, ¾ð¾î µ¶¸³ÀûÀ̶ó´Â Á¡À» ±×´ë·Î °è½ÂÇÑ XML ApplicationÀ̶ó°í »ý°¢ÇÏ¸é ½±´Ù. ÀÌ·¯ÇÑ XSL·Î »ý¼ºÇÑ ¹®¼­´Â XSL ½ºÅ¸ÀÏ ½ÃÆ®(StyleSheet)¶ó°í ºÒ¸®¸ç, DTD(Document Type Definition) ±×¸®°í, XML ¹®¼­¿Í ÇÔ²² µ¥ÀÌÅͷνáÀÇ °¡Ä¡¸¦ Áö´Ï°Ô µÈ´Ù.

1.1 XSLÀÇ ±¸¼º

XSL Àº Å©°Ô 2 °¡ÁöÀÇ ÆÄÆ®·Î ±¸¼ºµÈ´Ù. Çϳª´Â XML¹®¼­ÀÇ º¯È¯(Transformation)À» À§ÇÑ ¾ð¾î, ´Ù¸¥ Çϳª´Â Æ÷¸ËÆÃ ±¸¹®(Formatting Semantics)À» ±â¼úÇϱâ À§ÇÑ ¾îÈÖ(Vocabulary)·Î ÀÌ·ç¾îÁ®ÀÖ´Ù. º¯È¯À» À§ÇÑ ¾ð¾îÀÎ XSLT(XSL Transformations)´Â XPath(XML Path Language)¿Í ÇÔ²² »ç¿ëÇÏ¿© XSLÀÇ ±âº» °ñ°ÝÀ» ±¸¼ºÇÑ´Ù. ÀÌ·¯ÇÑ ±âº» °ñ°ÝÀ§¿¡ Æ÷¸ËÆÃÀ» À§ÇÑ ¾îÈÖ¸¦ »ç¿ëÇÏ¿© XML¹®¼­¸¦ Ç¥ÇöÇϱ⵵ ÇÏÁö¸¸, ´Ù¸¥ ÇüÅÂÀÇ ¹®¼­¸¦ »ý¼ºÇϱ⵵ ÇÑ´Ù.

[±×¸² 1] XSL ±¸¼º

±×¸²1 ¿¡¼­ º¸ÀÌ´Â XSL ½ºÅ¸ÀÏ ½ÃÆ®´Â ÇϳªÀÇ Àß±¸¼ºµÈ(Well-Formed) XML ¹®¼­´Ù. ÃÖ»óÀ§ ¿¤¸®¸ÕÆ®(Element)ÀÎ xsl:sytlesheet¿Í xsl:template, xsl:apply-templates, fo:blockÀº ¸ðµÎ ½ÃÀÛű×(Start-Tag)¿Í ³¡ÅÂÅ©(End-Tag) ȤÀº ºó ű×(Empty Tag)·Î ±¸¼ºµÇ°í, XML ¿øÄ¢À» Áؼö Çϰí ÀÖ´Ù. XSLÀº ´Ù¾çÇÑ ±¸¼º¿ä¼ÒµéÀ» Æ÷ÇÔÇϱâ À§ÇØ ³×ÀÓ½ºÆäÀ̽º(Namespaces)¸¦ »ç¿ëÇÏ¿© °¢ ±¸¼º¿ä¼ÒÀÇ ¿¤¸®¸ÕÆ®µéÀ» ±¸ºÐ ¹× ó¸® Çϵµ·Ï ±ÔÁ¤Çϰí ÀÖ´Ù. ³×ÀÓ½ºÆäÀ̽º¿¡ »ç¿ëµÇ´Â URI(Uniform Resource Identifier)´Â ½ºÆå¿¡ ±â¼úµÇ¾î ÀÖ´Â °ÍÀ» »ç¿ëÇÑ´Ù.

 <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:fo="http://www.w3.org/1999/XSL/Format">
  

xsl:stylesheet´Â XSLTÀÇ ÃÖ»óÀ§ ¿¤¸®¸ÕÆ®·Î XSL ½ºÅ¸ÀÏ ½ÃÆ®¿¡¼­ À¯ÀÏÇϵµ·Ï ±ÔÁ¤Çϸç, ¿¤¸®¸ÕÆ®¿¡ ÇØ´çÇÏ´Â ¼Ó¼ºÀ» ±â¼úÇÏ¿© ½ºÅ¸ÀÏ ¹®¼­ÀÇ Ãß°¡ Á¤º¸¸¦ ³ªÅ¸³»µµ·Ï ÇÑ´Ù. Áï, xsl:À» Á¢µÎ»ç·Î °®´Â ¿¤¸®¸ÕÆ® À̸§Àº "http://www.w3.org/1999/XSL/Transform"ÀÇ ¿¤¸®¸ÕÆ®·Î¼­ ó¸®Ç϶ó´Â Àǹ̸¦ °®´Â´Ù. fo:¸¦ Á¢µÎ»ç·Î °®´Â ¿¤¸®¸ÕÆ® À̸§Àº "http://www.w3.org/1999/XSL/Format"ÀÇ ¿¤¸®¸ÕÆ®·Î¼­ ó¸®Ç϶ó´Â Àǹ̸¦ °®´Â´Ù. ¿©±â¼­ xsl:Àº XSLÀÇ ±âº»°ñ°Ý ¹× ÃÖ»óÀ§ ¿¤¸®¸ÕÆ®¿¡ »ç¿ëµÇ¸ç, fo:´Â Æ÷¸ËÆÃÀ» À§ÇÑ ¿¤¸®¸ÕÆ®¿¡ »ç¿ëµÈ´Ù.

XSLÀÇ ±âº»Àº ·ê(Rule)µé·Î ±¸¼ºµÈ´Ù.(Áï, ·ê±â¹Ý 󸮰¡ ÀÌ·ç¾î Áø´Ù´Â¶æ) ·êÀº XSLTÀÇ ¿¤¸®¸ÕÆ®Áß templateÀ» »ç¿ëÇϸç, ÅÛÇø®Æ®·ê(Tempalte Rule) ȤÀº »ý¼º±ÔÄ¢(Construction Rule)À¸·Î ºÒ¸°´Ù. ÅÛÇø®Æ®·êÀº xsl:template ¿¤¸®¸ÕÆ®¿¡ match ¼Ó¼ºÀÇ °ªÀÎ ÆÐÅÏ(Pattern)À̶ó°í ºÒ¸®´Â Ç¥Çö¿¡ µû¶ó 󸮵ȴÙ. ÀÌ·¯ÇÑ Ç¥ÇöÀº XPath¸¦ »ç¿ëÇϸç, XPath´Â ÀÔ·ÂÆ®¸®(Source Tree)ÀÎ XML¹®¼­¿¡ Á¢±ÙÇϱâ À§ÇÑ ¾ð¾î´Ù. ÅÛÇø®Æ®·ê ³»ºÎ¿¡¼­ »ç¿ëµÇ´Â xsl:apply-templates´Â ÅÛÇø®Æ®·êµéÀ» ¿¬°áÇÏ¿© ÇϳªÀÇ °á°úÆ®¸®(Result Tree)¸¦ »ý¼ºÇÏ´Â ¿ªÇÒÀ» ÇÑ´Ù.

 <xsl:template match="/">
  <xsl:apply-templates select="block"/>
 </xsl:template>
  
 or
   
 <xsl:template match="block">
  <fo:block>
   <xsl:apply-templates/>
  </fo:block>
 </xsl:template>
  

[ ±×¸² 2 ] XSLT/XPath/FO °ü°è

±×¸²2 ¿¡¼­ ó·³ XSLT´Â ·êÀÇ ¿µ¿ª³»ºÎ¿¡ Æ÷¸ËÆÃ °´Ã¼³ª º¯È¯ÈÄ °á°ú¸¦ À§ÇÑ ´Ù¸¥Çü½ÄÀÇ µ¥ÀÌÅ͸¦ Æ÷ÇÔÇÒ ¼ö ÀÖµµ·Ï µÇ¾îÀÖ´Ù. ¶ÇÇÑ ·ê 󸮸¦ À§ÇÑ ³ëµåÀÇ ¼±Åà ¹× ó¸® ¹æ¹ýÀÇ Á¶°Ç±â¼ú, °á°ú Æ®¸®¿¡ »ðÀ﵃ µ¥ÀÌÅÍ »ý¼º µîÀÇ ´Ù¾çÇÑ ¸ñÀûÀ» Ç¥ÇöÇϱâ À§ÇÑ XPath¸¦ ±â¹ÝÀ¸·Î Çϰí ÀÖ´Ù.

2. XSLT ÀÌÇØ(1)

XSLT Ç¥ÁØ¾È »óÅ¿¡ ´ëÇØ..

XSLT´Â 1999³â 11¿ù 16ÀÏ ÇöÀç W3C(World Wide Web Consortium)¿¡ XSLT 1.0 À¸·Î ±Ç°í(Recommendation) µÇ¾ú°í, 2000³â 12¿ù 12ÀÏ ÇöÀç XSLT 1.1 ÀÌ °³¹ß´Ü°è(Working Draft)¿¡ ÀÖ´Ù.

2.1 XSLT ó¸® °³³ä

ÅÛÇø®Æ®·êÀº XSLT Áö½Ã(Instruction) ³ëµå¿Í Æ÷¸ËÆÃ ³ëµå µîÀ¸·Î ±¸¼ºµÈ ´ÜÆíÀûÀÎ Æ®¸®(Fragments Tree) ÀÌ´Ù. °¢ ÅÛÇø®Æ®·êÀº XPath Ç¥Çö½ÄÀ» Æ÷ÇÔÇÑ XSLT Áö½Ã ³ëµå¿Í °ü°èµÇ´Â XML ¿¤¸®¸ÕÆ® ³ëµå¿¡ ´ëÇÑ Á¢±Ù ó¸®ÈÄ, °á°úÆ®¸®ÀÎ ´ÜÆíÆ®¸®°¡ »ý¼ºµÈ´Ù. ¶ÇÇÑ °á°ú ´ÜÆí Æ®¸®µéÀº ÅÛÇø®Æ®·êÁß ¿¬°áÀ» À§ÇÑ XSLT Áö½Ã ³ëµåÀÇ Ã³¸®°úÁ¤¿¡ ÀÇÇØ ÇϳªÀÇ Æ®¸® °á°ú¹°·Î »êÃâµÈ´Ù.

[ ±×¸² 1 ] XSLT ó¸® °³³ä

±×¸²1ÀÇ XSLT ó¸® °³³äµµ¿¡¼­ XSL ½ºÅ¸ÀÏ½ÃÆ®´Â °¢°¢ÀÌ ´ÜÆí Æ®¸®·Î ±¸¼ºµÈ ÅÛÇø®Æ®·êµéÀ» Æ÷ÇÔÇϰí ÀÖ´Ù. ÅÛÇø®Æ®·êÀÇ Áö½Ã³ëµå´Â XPath Ç¥Çö 󸮽à XML ¹®¼­ÀÎ ÀÔ·Â Æ®¸®ÀÇ ÀϺΠ³ëµå¿¡ Á¢±ÙÇÑ´Ù. ÅÛÇø®Æ®·êÀÇ ´ÜÆí Æ®¸®¸¦ ¹ÙÅÁÀ¸·Î, ¶Ç ´Ù¸¥ Áö½Ã³ëµå 󸮿¡ ÀÇÇØ °á°ú Æ®¸®¸¦ ÇϳªÀÇ ´ÜÆí Æ®¸®·Î »ý¼ºÇÑ´Ù.

2.2 ÅÛÇø®Æ® ¸ÅĪ(Template Matching)

ÅÛÇø®Æ® ¸ÅĪÀ̶õ ½±°Ô ¿¹±âÇØ¼­ ÀÔ·Â ¹®¼­ÀÇ ¿¤¸®¸ÕÆ®¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ®·êÀ» Àû¿ë½ÃŰ´Â °ÍÀÌ´Ù.

 <memo>
  <to>È«±æµ¿</to>
  <from>±èµ¹¼è</from>
  <say>¾È³çÇϼ¼¿ä.<say>
 </memo>

 <xsl:template match="memo">
  ...
 </xsl:template>
   

À§ÀÇ XML ¹®¼­´Â <memo>¿¤¸®¸ÕÆ®¸¦ ·çÆ®(root)·Î ÇÏ´Â Æ®¸®°¡ ±×¸²2 ¿¡¼­ º¸¿©Áø´Ù. Æ®¸®´Â ±â¼úµÈ ¿¤¸®¸ÕÆ®ÀÇ ¼ø¼­¿¡ ÀÇÇØ ±íÀÌ ¿ì¼± Ž»öÀ» ÅëÇÑ Á¢±ÙÀÌ ÀÌ·ç¾î Áöµµ·Ï ÇÑ´Ù. ¶ÇÇÑ, <memo>¿¤¸®¸ÕÆ®¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ®·êÀÌ Á¤ÀǵǾî ÀÖ´Ù.

[ ! ] ¸ðµç XML ¹®¼­ÀÇ ·çÆ® ¿¤¸®¸ÕÆ® À§¿¡´Â ÃÖ»óÀ§ ·çÆ®°¡ Á¸ÀçÇÑ´Ù. Áï, XML ³»¿ëÀÇ ·çÆ®°¡ ¾Æ´Ñ XML ¹®¼­ÀÇ ·çÆ®¸¦ ÀǹÌÇÑ´Ù. / ¸¦ »ç¿ëÇÏ¿© XML ¹®¼­ÀÇ ·çÆ®¸¦ Ç¥½ÃÇÑ´Ù.

XSLT ÇÁ·Î¼¼¼­´Â XML ¹®¼­ÀÇ ·çÆ®¿¡¼­ ºÎÅÍ XML ¹®¼­¿¡ Á¢±ÙÇÏ¿© ÅÛÇø®Æ®¸¦ ¸ÅνÃŲ´Ù. ÀÌ´Â ¸Å¿ì ´Ü¼øÇÑ ¹æ¹ýÀ¸·Î ¸ÅĪµÇ´Âµ¥, ÇöÀç ³ëµå¸¦ ±âÁØÀ¸·Î ÇÏ¿© ÅÛÇø®Æ® ¸ÅĪÀÌ °áÁ¤µÈ´Ù. ÃÖÃÊÀÇ ÇöÀç ³ëµå´Â ¹®¼­ÀÇ ·çÆ®ÀÎ / ÀÌ´Ù. ¶§¹®¿¡ XSLT ÇÁ·Î¼¼¼­´Â ÅÛÇø®Æ®·êÁß¿¡ / À» ÆÐÅÏÀ¸·Î ÇÏ´Â ÅÛÇø®Æ®¸¦ ã´Â´Ù. Áï, ÃÖÃÊ·Î ½ÃÀ۵Ǵ ÅÛÇø®Æ®·êÀº ´ÙÀ½°ú °°´Ù.

 <xsl:template match="/">
  <xsl:apply-templates/>
 </xsl:template>
   

À§ÀÇ ÅÛÇø®Æ®°¡ ¸ÅĪµÈ ÈÄ¿¡ »õ·Î¿î ÇöÀç ³ëµå¸¦ ¼±ÅÃÇϱâ À§ÇØ <xsl:apply-templates/>¸¦ »ç¿ëÇß´Ù. ÀÌ´Â ÇöÀç ³ëµå(¿©±â¼­´Â / )ÀÇ ÀÚ½Ä ³ëµåµéÀ» ¹Ýº¹ÀûÀ¸·Î ¼±ÅÃÈÄ ÅÛÇø®Æ®·êÀ» Àû¿ëÇ϶ó´Â Àǹ̴Ù. Áï, / ÀÇ ÀÚ½Ä ³ëµåÀÎ <memo> °¡ ¼±Åõǰí ÀÌ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ®°¡ ¸ÅĪµÈ´Ù.

<xsl:apply-templates/>°¡ ÇöÀç ³ëµåÀÇ ¸ðµç ÀÚ½Ä ¿¤¸®¸ÕÆ®µéÀ» ¹Ýº¹ÀûÀ¸·Î ¼±ÅÃÇ϶ó´Â ÀÇ¹Ì À̿ܿ¡ select ¼Ó¼ºÀ» »ç¿ëÇÏ¿© ¸ÅνÃų Àڽijëµå ¹× ƯÁ¤ ³ëµå¸¦ ¼±Åà ÇÒ ¼ö ÀÖ´Ù. Áï, ´ÙÀ½°ú °°ÀÌ »ç¿ëÇÒ ¼ö ÀÖ´Ù.

 <xsl:apply-templates select="memo"/>

 <xsl:apply-templates select="memo/from"/>

 <xsl:apply-templates select="."/>
   

select ¼Ó¼º°ªÀ¸·Î "memo" ´Â Àý´ë°æ·Î·Î ³ªÅ¸³»¸é "/memo" ¶ó´Â Àǹ̷ΠÇöÀç³ëµå´Â <memo> À̰í, "memo" ¸¦ ÆÐÅÏÀ¸·Î ÇÏ´Â ÅÛÇø®Æ®¸¦ ¸ÅνÃŲ´Ù. ¼Ó¼º°ªÀ¸·Î "memo/from" ´Â ÇöÀç ³ëµå°¡ <from> À̰í, "memo/from" À» ÆÐÅÏÀ¸·Î ÇÏ´Â ÅÛÇø®Æ®¸¦ ¸ÅνÃŲ´Ù. (ȤÀº "from" À» ÆÐÅÏÀ¸·Î ÇÏ´Â ÅÛÇø®Æ®¸¦ ¸ÅĪ, ÀÌ´Â ¿ì¼±¼øÀ§¿¡ ÁØÇÑ´Ù.) ¼Ó¼º°ªÀ¸·Î "." ´Â ÇöÀç ³ëµå ±× ÀÚüÀ̹ǷÎ, ¹«ÇÑ ·çÇÁ¿¡ ºüÁú¼ö ÀÖ´Ù.

2.3 ÅÛÇø®Æ® ¿¹Á¦

´ÙÀ½Àº 2.2 ÀÇ XML ¹®¼­¿¡ ´ëÇÑ ¿ÏÀüÇÑ XSL ½ºÅ¸ÀÏ ½ÃÆ®¸¦ º¸¿©ÁØ´Ù.

 <xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
   <HTML>
    <xsl:apply-templates/>
   </HTML>
  </xsl:template>

  <xsl:template match="memo">
   <xsl:apply-templates select="say"/>
   <xsl:apply-templates select="from"/>
   <xsl:apply-templates select="to"/>
  </xsl:template>

  <xsl:template match="say">
   <H1>
    <xsl:value-of select="."/>
   </H1>
  </xsl:template>

  <xsl:template match="from">
   <H2>
    <xsl:value-of select="."/>
   </H2>
  </xsl:template>
    
  <xsl:template match="to">
   <H3>
    <xsl:value-of select="."/>
   </H3>
  </xsl:template>   

 </xsl:stylesheet>
   

´ÙÀ½ ±×¸²2´Â À§ÀÇ ÅÛÇø®Æ®·êµéÀÌ Ã³¸®µÇ´Â °úÁ¤À» º¸ÀδÙ.

[ ±×¸² 2 ] ÅÛÇø®Æ® ¸ÅĪ °úÁ¤

½ºÅ¸ÀÏ½ÃÆ®´Â 5°³ÀÇ ÅÛÇø®Æ®·êÀ» Æ®¸® ³ëµå·Î ±¸¼ºÇϰí ÀÖÀ¸¸ç, °¢ ÅÛÇø®Æ®·êÀº ÅÛÇø®Æ® ¸ÅĪ¿¡ ÀÇÇØ ±×¸²2¿Í °°ÀÌ ¿¬°áµÈ´Ù. <xsl:value-of> ´Â select·Î ¼±ÅÃµÈ ³ëµåÀÇ ÅØ½ºÆ® ³ëµåÀÇ °ªÀ» »ðÀÔÇÑ´Ù.

ÃÖÁ¾ º¯È¯ °á°ú´Â ´ÙÀ½°ú °°´Ù.

 <HTML>
  <H1>¾È³çÇϼ¼¿ä.</H1>
  <H2>±èµ¹¼è</H2>
  <H3>È«±æµ¿</H3>
 </HTML>
   

3. XSLT ÀÌÇØ(2)

3.1 XSLT ¿¤¸®¸ÕÆ®(XSLT Eelement)

Stylesheet Element [§2.2]

 <xsl:stylesheet
  id = id 
  extension-element-prefixes = tokens 
  exclude-result-prefixes = tokens 
  version = number>
   <!-- Content: (xsl:import*, top-level-elements) -->
 </xsl:stylesheet>

 <xsl:transform
  id = id 
  extension-element-prefixes = tokens 
  exclude-result-prefixes = tokens 
  version = number>
   <!-- Content: (xsl:import*, top-level-elements) -->
 </xsl:transform>     

[ ! ] xsl:stylesheet ¿Í xsl:transform ´Â µ¿ÀǾî·Î »ç¿ëÇÔ

Stylesheet Inclusion [§2.6.1]

 <xsl:include href = uri-reference/>   

Stylesheet Import [§2.6.2]

 <xsl:import href = uri-reference/>   

Whitespace Stripping [§3.4]

 <xsl:strip-space elements = tokens/>

 <xsl:preserve-space elements = tokens/>   

Defining Template Rules [§5.3]

 <xsl:template 
  match = number 
  name = id 
  priority = tokens 
  mode = tokens>
   <!-- Content: (xsl:param*, template) -->
 </xsl:template>   

Applying Template Rules [§5.4]

 <xsl:apply-templates select = node-set-expression 
  mode = qname/>

 <xsl:apply-templates 
  select = node-set-expression 
  mode = qname>
   <!-- Content: (xsl:sort | xsl:with-param)* -->
 </xsl:apply-templates>   

Overriding Template Rules [§5.6]

 <xsl:apply-imports/>   

Named Templates [§6]

 <xsl:call-template name = qname/>

 <xsl:call-template 
  name = qname>
   <!-- Content: xsl:with-param* -->
 </xsl:call-template>   

Namespace Alias [§7.1.1]

 <xsl:namespace-alias 
  stylesheet-prefix = prefix | "#default" 
  result-prefix = prefix | "#default"/>   

Creating Elements [§7.1.2]

 <xsl:element 
  name = { qname } 
  namespace = { uri-reference } 
  use-attribute-sets = qnames>
   <!-- Content: template -->
 </xsl:element>   

Creating Attributes [§7.1.3]

 <xsl:attribute 
  name = { qname } 
  namespace = { uri-reference }>
   <!-- Content: template -->
 </xsl:attribute>   

Named Attribute Sets [§7.1.4]

 <xsl:attribute-set 
  name = qname 
  use-attribute-sets = qnames>
   <!-- Content: xsl:attribute* -->
 </xsl:attribute-set>   

Creating Text [§7.2]

 <xsl:text
  disable-output-escaping = "yes" | "no">
   <!-- Content: #PCDATA -->
 </xsl:text>   

Creating Processing Instructions [§7.3]

 <xsl:processing-instruction
  name = { ncname }>
   <!-- Content: template -->
 </xsl:processing-instruction>   

Creating Comments [§7.4]

 <xsl:comment>
  <!-- Content: template -->
 </xsl:comment>   

Copying [§7.5]

 <xsl:copy
  use-attribute-sets = qnames>
   <!-- Content: template -->
 </xsl:copy>   

Generating Text [§7.6.1]

 <xsl:value-of
  select = string-expression
  disable-output-escaping = "yes" | "no"/>   

Attribute Value Templates [§7.6.2]

 <element attribute = "{expression}"/>   

Numbering [§7.7]

 <xsl:number 
  level = "single" | "multiple" | "any" 
  count = pattern 
  from = pattern 
  value = number-expression 
  format = { string } 
  lang = { nmtoken } 
  letter-value = { "alphabetic" | "traditional" } 
  grouping-separator = { char } 
  grouping-size = { number }/>   

Repetition [§8]

 <xsl:for-each
  select = node-set-expression>
   <!-- Content: (xsl:sort*, template) -->
 </xsl:for-each>   

Conditional Processing [§9]

 <xsl:if
  test = boolean-expression>
   <!-- Content: template -->
 </xsl:if>   
 
 <xsl:choose>
  <!-- Content: (xsl:when+, xsl:otherwise?) -->
 </xsl:choose>   

 <xsl:when
  test = boolean-expression>
   <!-- Content: template -->
 </xsl:when>   

 <xsl:otherwise>
  <!-- Content: template -->
 </xsl:otherwise>   

Sorting [§10]

 <xsl:sort 
  select = string-expression 
  lang = { nmtoken } 
  data-type = { "text" | "number" | qname-but-not-ncname } 
  order = { "ascending" | "descending" } 
  case-order = { "upper-first" | "lower-first" }/>   

Variables and Parameters [§11]

 <xsl:variable name = qname 
  select = expression/>

 <xsl:variable 
  name = qname>
   <!-- Content: template -->
 </xsl:variable>   
 
 <xsl:param name = qname 
  select = expression/>

 <xsl:param 
  name = qname>
   <!-- Content: template -->
 </xsl:param>  

Using Values of Variables and Parameters [§11.3]

 <xsl:copy-of
  select = exprssion/>   

Passing Parameters to Templates [§11.6]

 <xsl:with-param name = qname
  select = expression/>

 <xsl:with-param
  name = qname>
   <!-- Content: template -->
 </xsl:with-param>   
 <xsl:key
  name = qname
  match = pattern
  use = expression/>   

Number Formatting [§12.3]

 <xsl:decimal-format 
  name = qname 
  decimal-separator = char 
  grouping-separator = char 
  infinity = string 
  minus-sign = char 
  NaN = string 
  percent = char 
  per-mille = char 
  zero-digit = char 
  digit = char 
  pattern-separator = char/>   

Messages [§13]

 <xsl:message 
  terminate = "yes" | "no">
   <!-- Content: template -->
 </xsl:message>   

Fallback [§15]

 <xsl:fallback>
   <!-- Content: template -->
 </xsl:fallback>   

Output [§16]

 <xsl:output 
  method = "xml" | "html" | "text" | qname-but-not-ncname 
  version = nmtoken 
  encoding = string 
  omit-xml-declaration = "yes" | "no" 
  standalone = "yes" | "no" 
  doctype-public = string 
  doctype-system = string 
  cdata-section-elements = qnames 
  indent = "yes" | "no" 
  media-type = string/>   

 Key

 xsl:stylesheet  Element
 version   ¹Ýµå½Ã ¿ä±¸µÇ´Â ¼Ó¼º(Required attribute)
 version   ¼±ÅÃÀûÀ¸·Î Á¸ÀçÇÏ´Â ¼Ó¼º(Optional attribute)
 {expression}  Attribute value template
 template   ÅÛÇø®Æ®³»¿¡¼­ ¾î¶²°Íµµ Çã¿ë
 |   ¾çÀÚ ÅÃÀÏ ±¸ºÐ(or)
 ?   0¹ø ȤÀº Çѹø ¹Ýº¹
 *   0¹ø ÀÌ»ó ¹Ýº¹
 +   1¹ø ÀÌ»ó ¹Ýº¹
 #PCDATA   ÆÄ½ÌµÈ ¹®ÀÚ µ¥ÀÌÅÍ

 Attribute Value Type
  
 boolean-expression  ºÒ ³í¸®¿¬»ê(Boolean)°ªÀ» µ¹·ÁÁִ ǥÇö
 char   ´ÜÀÏ ¹®ÀÚ
 expression  Ç¥Çö
 id   ½Äº°ÀÚ(identifier)·Î »ç¿ëµÇ´Â XML À̸§ 
 ncname   qname¿¡¼­ Á¢µÎ»ç(prefix)¿Í ÄÝ·Ð(:)À» Á¦¿ÜÇÑ XML À̸§
 nmtoken   À̸§ ÅäÅ«(Name token)
 node-set-expression ÁýÇÕ³ëµå¸¦ µ¹·ÁÁִ ǥÇö
 number   ¸®ÅÍ·² °ª(Literal value)À¸·Î ¿©±â¼­´Â 1.0 À» »ç¿ë
 number-expression  ¼ýÀÚ¸¦ µ¹·ÁÁִ ǥÇö
 pattern   XSLT pattern
 prefix   ³×ÀÓ½ºÆäÀ̽º(Namespace) Á¢µÎ»ç
 qname   ¿É¼ÇÀÎ Á¢µÎ»ç¿Í ncnameÀ» Æ÷ÇÔÇÏ´Â Àû°ÝÇÑ ³×ÀÓ½ºÆäÀ̽ºÀÇ XML À̸§
 qname-but-not-ncname Á¢µÎ»ç¿Í ncnameÀ» Æ÷ÇÔÇÏ´Â Àû°ÝÇÑ ³×ÀÓ½ºÆäÀ̽º À̸§
 string-expression  ¹®ÀÚ¿­ Ç¥Çö
 token   ÅäÅ«
 uri-reference  URI ÂüÁ¶
   

3.2 XSLT ÇÔ¼öµé(XSLT Functions)

node-set document( object, node-set? ) [§12.1]

node-set key( string, obejct ) [§12.2]

string format-number( number, string, string? ) [§12.3]

node-set current( ) [§12.4]

string unparsed-entity-uri( string ) [§12.4]

string generate-id( node-set? ) [§12.4]

object system-property( string ) [§12.4]

boolean element-available( string ) [§15]

boolean function-available( string ) [§15]

4. XPath ÀÌÇØ

XPath Ç¥ÁØ¾È »óÅ¿¡ ´ëÇØ..

XPath´Â XSLT 1.0°ú ÇÔ²² 1999³â 11¿ù 16ÀÏ ÇöÀç W3C(World Wide Web Consortium)¿¡ XPath 1.0 À¸·Î ±Ç°í(Recommendation) µÇ¾îÀÖ´Ù. XPath´Â XSLTÀÇ Ç¥Çö ¾ð¾î(Expression language)·Î½á XSLTÀÇ ¼Ó¼º¿¡¼­ »ç¿ëµÈ´Ù.

XPath´Â XML ¹®¼­ÀÇ Æ¯Á¤ ¿¤¸®¸ÕÆ®(¼Ó¼º,PI ..) À§Ä¡¸¦ ¾î¶»°Ô ±â¼úÇÏ´ÂÁö µîÀÇ ±âº»ÀûÀΰÍÀ» Á¦°øÇϸç, °£°áÇÏ°Ô Ç¥Çö ÇÒ ¼ö ÀÖ´Ù. ¶ÇÇÑ XPath´Â XSLT¿Í XPointer¿¡¼­ ±â¹ÝÀ¸·Î »ç¿ëµÇµµ·Ï ¼³°èµÇ¾î ÀÖ´Ù. ¶§¹®¿¡ XPath´Â ¹®ÀÚ¿­ ±â¹ÝÀÇ(String-based) ¹®¹ýÀ» ¹ÙÅÁÀ¸·Î ¼Ó¼ºÀ̳ª URIs ¿¡¼­ Ç¥Çö °¡´ÉÇÏ´Ù. ±×·¯³ª, XSLT¿Í XPointer¿¡¼­ »ç¿ëµÇ´Â XPath°¡ ¿ÏÀüÈ÷ µ¿ÀÏÇÏÁö ¾Ê±â¶§¹®¿¡ ÇÙ½É ÇÔ¼ö(Core Function)¸¦ µÎ¾î ±â´ÉÀûÀ¸·Î °°µµ·Ï ÇÑ´Ù.

4.1 XPath µ¥ÀÌÅÍ ¸ðµ¨(Data Model)

XPathÀÇ µ¥ÀÌÅÍ ¸ðµ¨Àº ³í¸®ÀûÀÎ(Logical) Æ®¸®·Î¼­ XML ¹®¼­¸¦ ´Ù·é´Ù. ³í¸®Àû Æ®¸®´Â °¢ ³ëµå¸¦ ŸÀÔÀ¸·Î ±¸ºÐÇÏ¿©, ŸÀÔ¿¡´Â ¿¤¸®¸ÕÆ®(Element), ¼Ó¼º(Attribute), ÅØ½ºÆ®(text), ó¸®Áö½Ã(Processing Instruction), ÁÖ¼®(Comment), ³×ÀÓ½ºÆäÀ̽º(Namespace), ·çÆ®(Root)°¡ ÀÖ´Ù. ½ÇÁ¦ ¹®¼­¸¦ Æ®¸®·Î Ç¥ÇöÇÒ¶§ ¹°¸®ÀûÀÎ Æ®¸®¿¡ ºñÇØ ³í¸®ÀûÀÎ Æ®¸®´Â 󸮰úÁ¤ÀÌ µ¶¸³ÀûÀÏ ¼ö ÀÖ´Ù.

[ ±×¸² 1 ] XPath µ¥ÀÌÅÍ ¸ðµ¨

±×¸²1 ¿¡¼­ ÁÂÃøºÎºÐÀÌ ½ÇÁ¦ ¹®¼­¸¦ ¹°¸®ÀûÀÎ Æ®¸®·Î Ç¥ÇöÇÑ °ÍÀ̰í, ¿ìÃøÀÌ ³í¸®ÀûÀ¸·Î Æ®¸®¸¦ Ç¥ÇöÇÑ °ÍÀÌ´Ù. /´Â Root·Î, <doc>, <para>, <em> ¿¤¸®¸ÕÆ®µéÀº ¸ðµÎ E·Î ´ëÀÀµÇ°í, <?Pub Caret?>´Â PI·Î, "Some", "emphasis" µîÀÇ ¹®ÀÚ¿­µéÀº Text·Î ´ëÀÀµÈ´Ù. ÀÌó·³ ±×¸²1Àº ¹°¸®ÀûÀÎ Æ®¸®ÀÇ ³ëµå¸¦ ÀϹÝÈ­½ÃÄÑ ³í¸®ÀûÀÎ ³ëµåÀÇ Æ®¸®·Î º¸¿©ÁØ´Ù. XPath´Â ÀÌ·¯ÇÑ ³í¸®Àû Æ®¸®¿¡¼­ ³ëµåµéÀ» ´Ù·ç°í, ÇÙ½É ÇÔ¼öµéÀ» »ç¿ëÇÏ¿© ¼¼ºÎÀûÀÎ ±â´ÉµéÀ» ÀÌ¿ëÇϵµ·Ï ¼³°èµÇ¾î ÀÖ´Ù.

4.2 Ç¥Çö ±¸Á¶(Expression Syntax)

XPath´Â XSLTÀÇ ÆÐÅÏ(Pattern)¿¡ »ç¿ëµÇ´Â À§Ä¡°æ·Î(Location Path)¿Í À̸¦ Æ÷ÇÔÇϸç Á»´õ ´Ù¾çÇÑ Ç¥ÇöÀ» À§ÇÑ Ç¥Çö¹ý(Expressions)ÀÌ ÀÖ´Ù. ¿ÏÀüÇÑ Ç¥Çö¾ð¾î(Expression Language)´Â À§Ä¡°æ·Î¿Í À§Ä¡°æ·Î ÀÌ»óÀÇ Ç¥Çö, ±×¸®°í ´Ù¾çÇÑ °è»êÀ» ¼öÇàÇÏ°í °´Ã¼(Object)¸¦ ºñ±³Çϱâ À§ÇÑ ¿¬»êÀÚ(operators), ´Ù¾çÇÑ Å¸ÀÔ ºÐ¼® ¹× °ü¸®¸¦ À§ÇÑ ÇÔ¼ö¸¦ »ç¿ëÇÏ¿© Ç¥ÇöÇÒ ¼ö ÀÖ´Ù.

[ ! ] XSLT ÆÐÅÏ¿¡ »ç¿ëµÇ´Â ÆÐÅϾð¾î(Pattern Language)´Â XPathÀÇ ÀϺκÐÀ¸·Î º¼¼ö ÀÖÁö¸¸, XSLT ÅÛÇø®Æ® ¸ÅĪ¿¡ Á¦ÇÑÀûÀÌ°í ¾à°£ÀÇ Ç¥Çö¸¸À» Çã¿ëÇÏ´Â XSLT Ç¥ÁØÀÌ´Ù. ±×·¯¹Ç·Î, XSLT ÆÐÅÏ ¾ð¾î¿Í XPath ÀÇ Ç¥Çö ¾ð¾î(Expression Language)´Â ´Ù¸£´Ù°í º¼ ¼ö ÀÖ´Ù.

À§Ä¡°æ·Î(Location Path)´Â Àý´ë°æ·Î(Absolute Location Path)¿Í »ó´ë°æ·Î(Relative Location Path)·Î Ç¥ÇöµÉ ¼ö ÀÖ´Ù. Àý´ë°æ·Î´Â ¹®¼­ ±¸Á¶»ó ÃÖ»óÀ§ ³ëµåÀÎ ·çÆ®( /)¿¡¼­ ½ÃÀÛÇØ ¿øÇÏ´Â À§Ä¡±îÁöÀÇ °æ·Î¸¦ Ç¥ÇöÇÑ´Ù. »ó´ë°æ·Î´Â ÇöÀç³ëµå(Current Node)¿¡¼­ ½ÃÀÛÇØ ¿øÇÏ´Â À§Ä¡±îÁöÀÇ °æ·Î¸¦ Ç¥ÇöÇÑ´Ù.

°æ·Î´Â ´Ü°è(½ºÅÜ:Step)µé·Î ±¸¼ºµÇ¸ç, stepÀº ±âÃʺÎ(º£À̽ýº:Basis)¿Í ¼ú¾îºÎ(ÇÁ¸®µðÄÉÀÌÆ®:Predicate)·Î ±¸¼ºµÈ´Ù. basis´Â Ãà(¿¢½Ã½º:Axis)°ú ³ëµå°Ë»ç(³ëµåÅ×½ºÆ®:Node Test)·Î ±¸¼ºµÇ¸ç, »ý·«°¡´ÉÇÑ predicate´Â ´ë°ýÈ£(square bracket)·Î ¹­ÀΠǥÇö½ÄÀ¸·Î ±¸¼ºµÈ´Ù. axis´Â 13°³ÀÇ ÃàÀ̸§(¿¢½Ã½º³×ÀÓ:Axis Name)°ú ´õºí ÄÝ·Ð(::)À¸·Î ±¸¼ºµÇ°í, node test´Â ¿¤¸®¸ÕÆ® À̸§À̳ª ³ëµå ŸÀÔ(Node Type : node, comment, text, processing-instruction)À¸·Î ±¸¼ºµÈ´Ù.

Axis Name

Node Test

ancestor::
ancestor-or-self::
attribute::
child::
descendant::
descendant-or-self::
following::
following-sibling::
namespace::
parent::
preceding::
preceding-sibling::
self::   
name
URI:name
prefix:name
*
prefix:*
node()
comment()
text()
processing-instruction()
processing-instruction(literal)
   

[ ! ] attribute:: axis´Â attribute ³ëµåÀÇ °³³äÀ̰í,namespace:: axis´Â namespace ³ëµåÀÇ °³³äÀÌ´Ù.. ´Ù¸¥ axes´Â element ³ëµå¿¡ ´ëÀÀ µÇ´Â °³³äÀÌ´Ù.

[ ±×¸² 2 ] À§Ä¡°æ·Î(location path)

±×¸²2´Â À§Ä¡°æ·ÎÀÇ °£´ÜÇÑ ¿¹Á¦¸¦ º¸¿©ÁØ´Ù. stepÀº "/"·Î ±¸ºÐÇϰí, ¿À¸¥ÂÊ¿¡¼­ ºÎÅÍ ¿ÞÂÊÀ¸·Î ÀÐ¾î ¸ÅÄ¡½ÃŲ´Ù. Áï, °¡Àå ¿À¸¥ÂÊÀÌ ÇöÀç³ëµå¸¦ ³ªÅ¸³½´Ù. ù¹øÂ° stepÀº axis¿Í node test·Î ±¸¼º µÇ¾ú°í, axis nameÀº followingÀ» »ç¿ëÇß´Ù. µÎ¹øÂ° stepÀº ¿¤¸®¸ÕÆ® À̸§°ú Predicate·Î ±¸¼ºµÇ¾ú´Ù. ¸¶Áö¸· ¼¼¹øÂ° stepÀº ¿¤¸®¸ÕÆ® À̸§À¸·Î¸¸ ±¸¼ºµÇ¾î ÀÖ´Ù.

[ ±×¸² 3 ] Axes

±×¸²3Àº axes¿¡ ´ëÇØ ÇØ¼®ÇÑ ±×¸²ÀÌ´Ù. ÇöÀç³ëµå(current node)ÀÌÀÚ self:: axis nameÀº ȸ»öÀ¸·Î Ç¥½ÃµÈ ³ëµå¸¦ °¡¸£Å²´Ù. ±×¸²3ÀÇ ÁÂÃøÀº ancestor::, preceding-sibling::, following-sibling::, child:: axis nameÀ» Ç¥½ÃÇϸç, ³ëµå¾ÈÀÇ ¼ýÀÚ´Â ÂüÁ¶µÇ´Â ¼ø¼­´Ù. ¿ìÃøÀº preceding::, following, descendant:: axis nameÀ» Ç¥½ÃÇÑ´Ù. ancestor-or-self:: axis nameÀº ÇöÀç³ëµå¸¦ Æ÷ÇÔÇÑ ancestor:: ¸¦ ÀǹÌÇϸç, descendant-or-self:: axis nameÀº ÇöÀç³ëµå¸¦ Æ÷ÇÔÇÑ descendant:: ¸¦ ÀǹÌÇÑ´Ù. parent:: axis nameÀº ÇöÀç³ëµåÀÇ ºÎ¸ð ³ëµå¸¦ ÀǹÌÇÑ´Ù. attribute:: axis´Â ÄÁÅýºÆ® ³ëµå(Context node)ÀÇ attribute¸¦ Æ÷ÇÔÇϸç, namespace:: axis´Â ÄÁÅýºÆ® ³ëµåÀÇ namespace¸¦ Æ÷ÇÔÇÑ´Ù.

[ ! ] ÄÁÅýºÆ® ³ëµå(Context Node) : XSLT³ª XPointerÀÇ XPath Ç¥Çö ¹®¸Æ»ó °áÁ¤µÇ´Â ³ëµå¸¦ ÀǹÌÇÏ¸ç ³ëµå(context node), ¼ýÀÚ(context position : context size), ¿¬°áµÈ º¯¼ö ÁýÇÕ, ÇÔ¼ö, Ç¥ÇöÀ» À§ÇØ ¼±¾ðµÈ ³×ÀÓ½ºÆäÀ̽º ÁýÇÕ µîÀÌ µÉ ¼ö ÀÖ´Ù. º¸Åë ÇöÀç³ëµå¸¦ ÀǹÌÇÑ´Ù.

4.3 ´ÜÃà¹ý(Abbreviated Syntax)

XPath¿¡´Â Ç¥ÇöÀÇ °£·«È­¸¦ À§ÇØ ÇÊ¿ä¾ø´Â Ç¥ÇöÀ» »ý·«Çϰųª ´ëÄ¡ÇÏ´Â ¹æ¹ýÀ» »ç¿ëÇÑ´Ù.

°¡Àå ´ëÇ¥ÀûÀÎ child::´Â µðÆúÆ®(default)·Î ¾²ÀÌ´Â axis·Î½á º¸Åë »ý·«µÈ´Ù.

 div/para = child::div/child::para   

attribute:: axis ´Â @ ·Î ´ëÄ¡µÇ¾î »ç¿ëµÇ±âµµ ÇÑ´Ù.

 para[@type="warning"] = child::para[attribute::type="warning"]    

¸ðµç ¿¤¸®¸ÕÆ®¿¡ ´ëÀÀµÇ´Â Ç¥ÇöÀ¸·Î *¸¦ »ç¿ëÇϰųª, ¸ðµç ¾îÆ®¸®ºäÆ®¿¡ ´ëÀÀµÇ´Â @*¸¦ »ç¿ëÇϱ⵵ ÇÑ´Ù.

 * = child::*
 @* = attribute::*  

ÇöÀç ³ëµå Áï, self::node()¸¦ °£·«È­ ½ÃŲ .À» »ç¿ëÇϱ⵵ ÇÑ´Ù.

 ./para  = self::node()/child::para   

ºÎ¸ð ³ëµå Áï, parent::node()¸¦ °£·«È­ ½ÃŲ ..À» »ç¿ëÇϱ⵵ ÇÑ´Ù.

 ../title = parent::node()/child::title   

Ưº°È÷ //¸¦ »ç¿ëÇÏ¿© ÄÁÆ®½ºÆ® ³ëµåÀÇ ¸ðµç Èļճëµå(/descendants-or-self::node())¸¦ ¼±ÅÃÇÒ ¼ö µµ ÀÖ´Ù.

 .//para  = self::node()/descendant-or-self::node()/child::para   

·çÆ®³ëµå´Â /·Î ³ªÅ¸³½´Ù.

 

4.4 ±âŸ Ç¥Çö½Ä

Booleans

or , and , = , != , <= , < , >= , >

Numbers

+ , - , div , mod

4.5 XPath Syntax Sample

´ÜÃàÇÏÁö ¾ÊÀº Ç¥Çö(unabbreviated syntax) vs ´ÜÃà Ç¥Çö(Abbreviated Syntax)

child::para para
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä ³ëµåÁß para ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
child::* *
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::text() text()
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä ÅØ½ºÆ® ³ëµå ¼±Åà  
attribute::name @name
ÄÁÅýºÆ® ³ëµåÀÇ name ¾îÆ®¸®ºäÆ® ¼±ÅÃ
attribute::* @*
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ¾îÆ®¸®ºäÆ® ¼±ÅÃ
child::chapter/descendant::para chapter//para
ÄÁÅýºÆ® ³ëµåÀÇ ÀÚ½Ä ³ëµå°¡ chapter ¿¤¸®¸ÕÆ®À̰í, chapter ¿¤¸®¸ÕÆ®ÀÇ ÈÄ¼Õ ³ëµå°¡ para ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
child::*/child::para */para
ÄÁÅýºÆ® ³ëµåÀÇ ¼ÕÀÚ ³ëµå°¡ para ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
/descendant::para //para
¹®¼­³»ÀÇ ¸ðµç para ¿¤¸®¸ÕÆ® ¼±ÅÃ
/descendant::olist/child::item //olist/item
¹®¼­³»¿¡¼­ olist ¿¤¸®¸ÕÆ®¸¦ ºÎ¸ð·Î °¡Áö´Â ¸ðµç item ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::para[position()=1] para[1]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä ³ëµåÁß Ã¹¹øÂ° para ¿¤¸®¸ÕÆ® ¼±Åà 
child::para[position()=last()] para[last()]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä ³ëµåÁß ¸¶Áö¸· para ¿¤¸®¸ÕÆ® ¼±ÅÃ
/child::doc/child::chapter[position()=5]/child::section[position()=2] /doc/chapter[5]/section[2]
¹®¼­ÀÇ doc ¿¤¸®¸ÕÆ®ÀÇ 5¹øÂ° ÀÚ½Ä chpater ¿¤¸®¸ÕÆ®ÀÇ 2¹øÂ° ÀÚ½Ä section ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::para[attribute::type="warning"] para[@type="warning"]
ÄÁÅýºÆ® ³ëµåÀÇ type ¾óÆ®¸®ºäÆ® °ªÀÌ 'warning' ÀÎ ¸ðµç ÀÚ½Ä para ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::para[attribute::type='warning'][position()=5] para[@type="warning"][5]
ÄÁÅýºÆ® ³ëµåÀÇ type ¾óÆ®¸®ºäÆ® °ªÀÌ 'warning' ÀÎ ¸ðµç ÀÚ½Ä para ¿¤¸®¸ÕÆ®Áß 5 ¹øÂ° para ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::para[position()=5][attribute::type="warning"] para[5][@type="warning"]
ÄÁÅýºÆ® ³ëµåÀÇ 5¹øÂ° para ¿¤¸®¸ÕÆ®ÀÇ type ¾îÆ®¸®ºäÆ® °ªÀÌ 'warning' À̶ó¸é ¼±Åà 
child::chapter[child::title='Introduction'] chapter[title="Introduction"]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä chapter ¿¤¸®¸ÕÆ®Áß ÀÚ½Ä title ¿¤¸®¸ÕÆ®ÀÇ ÅØ½ºÆ® ³ëµå ½ºÆ®¸µ °ªÀÌ 'Introduction' ÀÎ°Í ¼±ÅÃ
child::chapter[child::title] chapter[title]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä chapter ¿¤¸®¸ÕÆ®Áß ÀÚ½ÄÀÌ title ¿¤¸®¸ÕÆ® ÀÎ°Í ¼±ÅÃ

´ÜÃàÇÏÁö ¾ÊÀº Ç¥Çö(unabbreviated syntax)

child::node()
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç Àڽijëµå(³ëµåŸÀÔ¿¡ »ó°ü¾ø´Â) ¼±ÅÃ
descendant::para
ÄÁÅýºÆ® ³ëµåÀÇ ÈÄ¼Õ ³ëµå°¡ para ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
ancestor::div
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç Á¶»ó ³ëµåÁß div ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
ancestor-or-self::div 
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç Á¶»ó ³ëµåÁß div ¿¤¸®¸ÕÆ®ÀΰÍ(ÄÁÅýºÆ® ³ëµå°¡ div ¿¤¸®¸ÕÆ®¶ó¸é ÄÁÅýºÆ® ³ëµå Æ÷ÇÔ) ¼±ÅÃ
descendant-or-self::para      
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÈÄ¼Õ ³ëµåÁß para ¿¤¸®¸ÕÆ®ÀΰÍ(ÄÁÅýºÆ® ³ëµå°¡ para ¿¤¸®¸ÕÆ®¶ó¸é ÄÁÅýºÆ® ³ëµå Æ÷ÇÔ) ¼±ÅÃ
self::para 
ÄÁÅýºÆ® ³ëµå°¡ para ¿¤¸®¸ÕÆ®¶ó¸é ¼±ÅÃÇÏ°í ¾Æ´Ï¶ó¸é ¾Æ¹«°Íµµ ¼±Åà ¾ÈÇÔ
/
¹®¼­ÀÇ ·çÆ® ¼±ÅÃ(¹®¼­¿¡¼­ Ç×»ó ÃÖ»óÀ§ ³ëµåÀÓ)
child::para[position()=last()-1] 
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä para ¿¤¸®¸ÕÆ® ³ëµåÁß ¸¶Áö¸· ¹Ù·Î ÀÌÀü ¼±ÅÃ
child::para[position()>1]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä prar ¿¤¸®¸ÕÆ® ³ëµåÁß Ã¹¹øÂ° ÀÌÈÄ ¼±ÅÃ
following-sibling::chapter[position()=1] 
ÄÁÅýºÆ® ³ëµåÀÇ ´ÙÀ½ ÇüÁ¦ chapter ¿¤¸®¸ÕÆ® ¼±ÅÃ
preceding-sibling::chapter[position()=1] 
ÄÁÅýºÆ® ³ëµåÀÇ ÀÌÀü ÇüÁ¦ chapter ¿¤¸®¸ÕÆ® ¼±ÅÃ
/descendant::figure[position()=42] 
¹®¼­³»ÀÇ 42¹øÂ° figure ¿¤¸®¸ÕÆ® ¼±ÅÃ
child::*[self::chapter or self::appendix] 
ÄÁÅýºÆ® ³ëµåÀÇ ÀÚ½Ä ³ëµå°¡ appendix ¿¤¸®¸ÕÆ®À̰ųª chapter ¿¤¸®¸ÕÆ®ÀÎ°Í ¼±ÅÃ
child::*[self::chapter or self::appendix][position()=last()] 
ÄÁÅýºÆ® ³ëµåÀÇ ¸¶Áö¸· ÀÚ½Ä chapter ¿¤¸®¸ÕÆ® ȤÀº ¸¶Áö¸· ÀÚ½Ä appendix ¿¤¸®¸ÕÆ® ¼±ÅÃ
   

´ÜÃà Ç¥Çö(Abbreviated Syntax)

.
ÄÁÅýºÆ® ³ëµå ¼±ÅÃ
.//para
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÈÄ¼Õ para ¿¤¸®¸ÕÆ® ¼±ÅÃ
..
ÄÁÅýºÆ® ³ëµåÀÇ ºÎ¸ð ¼±ÅÃ
../@lang
ÄÁÅýºÆ® ³ëµå ºÎ¸ðÀÇ lang ¾îÆ®¸®ºäÆ® ¼±ÅÃ
employee[@secretary and @assistant]
ÄÁÅýºÆ® ³ëµåÀÇ ¸ðµç ÀÚ½Ä employee ¿¤¸®¸ÕÆ®Áß secretary ¾îÆ®¸®ºäÆ®¿Í assistant ¾îÆ®¸®ºäÆ®¸¦ °¡Áø employee ¿¤¸®¸ÕÆ® ¼±ÅÃ
   

4.6 XPath ÇÙ½É ÇÔ¼ö(Core Functions)

Node Set Functions

number last() [§4.1]

number position() [§4.1]

number count(node-set) [§4.1]

node-set id(object) [§4.1]

string local-name(node-set?) [§4.1]

string namespace-uri(node-set?) [§4.1]

string name(node-set?) [§4.1]

String Functions

string string(object?) [§4.2]

string concat(string, string, string*) [§4.2]

boolean starts-with(string, string) [§4.2]

boolean contains(string, string) [§4.2]

boolean substring-before(string, string) [§4.2]

string substring-after(string, string) [§4.2]

string substring(string, number, number?) [§4.2]

number string-length(string?) [§4.2]

string normalize-space(string?) [§4.2]

string translate(string, string, string) [§4.2]

Boolean Functions

boolean boolean(object) [§4.3]

boolean not(object) [§4.3]

boolean true() [§4.3]

boolean false() [§4.3]

boolean lang(string) [§4.3]

Number Functions

number number(object?) [§4.4]

number sum(node-set) [§4.4]

number floor(number) [§4.4]

number ceiling(number) [§4.4]

number round(number) [§4.4]

5. XSL Stylesheet ¿¹Á¦ (1)

°£´ÜÇÑ XSL ½ºÅ¸ÀÏ½ÃÆ®ÀÇ ¿¹Á¦·Î½á ¸ÕÀú À̷¼­¸¦ ¸¸µé¾îº»´Ù.

5.1 À̷¼­ DTD

¸ÕÀú DTD¸¦ ¸¸µå´Â ÀÌÀ¯´Â °£´ÜÈ÷ ¼³¸íÇϰڴÙ. ½ºÅ¸ÀÏ½ÃÆ®¸¦ ¸¸µé±â À§ÇÑ °¡Àå Áß¿äÇÑ ÀÌÀ¯´Â XML ¹®¼­ÀÇ ±¸Á¶¸¦ ¾Ë¾Æ¾ß ½ºÅ¸ÀÏ½ÃÆ®¸¦ ¸¸µé ¼ö Àֱ⠶§¹®ÀÌ´Ù.

´ÙÀ½ À̷¼­ DTD´Â Internet Explorer ¿¡ ÀûÇÕÇϵµ·Ï ¼³°èµÇ¾úÀ¸¸ç, ÃÖÀûÈ­µÈ DTD´Â ¾Æ´Ï´Ù.

[ ! ] ´ÙÀ½ À̷¼­´Â °¡Àå ÀϹÝÀûÀ¸·Î »ç¿ëÇÏ´Â À̷¼­ ¼­½Ä¸¸À» ÂüÁ¶ÇÏ¿© ¼³°èÇÏ¿´´Ù. ¶§¹®¿¡ ´Ù¸¥ À̷¼­ ¼­½Ä°ú ¸ÂÁö ¾Ê´Â ºÎºÐÀÌ ÀÖÀ»¼ö ÀÖ´Ù. µû¶ó¼­ º» DTD¸¦ »ç¿ëÇÏ¿© ¹ß»ýÇÏ´Â ÇÇÇØ´Â º»Àο¡°Ô Ã¥ÀÓÀÌ ¾ø´Ù.

´ÙÀ½Àº profile.dtd ÀÌ´Ù.

 <!-- ÀÌ DTD´Â À̷¼­¸¦ À§ÇØ Á¦ÀÛ µÇ¾ú½À´Ï´Ù.    -->
 <!-- ÀÌ DTDÀÇ ÀÌ¿ë°ú ¹èÆ÷´Â ÁÖ¼®ÀÇ »èÁ¦¹× ¼öÁ¤ÀÌ ¾ø´ÂÇÑ ÀÚÀ¯ÀÔ´Ï´Ù.  -->
 <!-- Ãß°¡´Â °¡´ÉÇÕ´Ï´Ù¸¸ º»Àο¡°Ô Åëº¸ÇØÁֽʽÿä!   -->
 <!-- ¹èÀç´ëÇб³ ¸ÖƼ¹Ìµð¾î ¿¬±¸½Ç / ÀÌÇü¹®    -->
 <!-- http://mie.paichai.ac.kr/     -->
 <!-- 2000.03.27 / darkness@nate.com   -->

<!-- Standalone Parameter Entity Declarations used in the DTD  -->

<!ENTITY % doctype "À̷¼­">

<!ENTITY % p.date  "³â|¿ù|ÀÏ">
<!ENTITY % p.bth.day "³ªÀÌ|(%p.date;)">
<!ENTITY % p.pi.num "¾ÕÀÚ¸®,µÞÀÚ¸®">
<!ENTITY % m.fig  "EMPTY">
<!ENTITY % m.ph.addr "±¹¸í|½Ã|µµ|±º|±¸|À¾|¸é|µ¿|¿ìÆí¹øÈ£|»ç¼­ÇÔ¹øÈ£|ÀüÈ­¹øÈ£|ÆÑ½º¹øÈ£|ÀüÀÚ¿ìÆí¹øÈ£">

<!-- Mixed Parameter Entity Declarations used in the DTD  -->

<!ENTITY % m.addr  "#PCDATA | %m.ph.addr;">
<!ENTITY % m.lib  "(%p.date;)*, ³»¿ë,ºñ°í?">

<!-- Entities for common attributes     -->

<!ENTITY % a.id  "ID ID #IMPLIED">
<!ENTITY % a.lang  "(ÇѱÛ|¿µ¾î|ÇÑÀÚ|ÀϺ»¾î) 'ÇѱÛ'">
<!ENTITY % b.type  "(¾ç·Â|À½·Â) '¾ç·Â'">

<!--  Notation Declarations     -->

<!NOTATION  jpg   PUBLIC "">

<!--  Element Delclarations     -->

<!ELEMENT %doctype; (À̸§+,»çÁø?,Áֹεî·Ï¹øÈ£,»ý³â¿ùÀÏ,ÁÖ¼Ò,È£Àû°ü°è,(ÇзÂ|°æ·Â|Ư±â|ÀÚ°Ý)*)>

<!--  À̸§          -->

<!ELEMENT À̸§  (#PCDATA)>
<!ATTLIST À̸§  ¾ð¾î %a.lang;>

<!--  »çÁø          -->

<!ELEMENT »çÁø  %m.fig;>
<!ATTLIST »çÁø  %a.id;
   NAME     ENTITY  #IMPLIED>

<!--  Áֹεî·Ï¹øÈ£         -->

<!ELEMENT Áֹεî·Ï¹øÈ£ (%p.pi.num;)>
<!ELEMENT ¾ÕÀÚ¸®  (#PCDATA)>
<!ELEMENT µÞÀÚ¸®  (#PCDATA)>

<!--  »ý³â¿ùÀÏ          -->

<!ELEMENT »ý³â¿ùÀÏ  (%p.bth.day;)+>
<!ATTLIST »ý³â¿ùÀÏ  Ã¥·Â %b.type;>

<!ELEMENT ³ªÀÌ  (#PCDATA)>
<!ELEMENT ³â  (#PCDATA)>
<!ELEMENT ¿ù  (#PCDATA)>
<!ELEMENT ÀÏ  (#PCDATA)>

<!--  ÁÖ¼Ò          -->

<!ELEMENT ÁÖ¼Ò  (%m.addr;)*>
<!ELEMENT ±¹¸í  (#PCDATA)>
<!ELEMENT ½Ã  (#PCDATA)>
<!ELEMENT µµ  (#PCDATA)>
<!ELEMENT ±º  (#PCDATA)>
<!ELEMENT ±¸  (#PCDATA)>
<!ELEMENT À¾  (#PCDATA)>
<!ELEMENT ¸é  (#PCDATA)>
<!ELEMENT µ¿  (#PCDATA)>
<!ELEMENT ¿ìÆí¹øÈ£  (#PCDATA)>
<!ELEMENT »ç¼­ÇÔ¹øÈ£ (#PCDATA)>
<!ELEMENT ÀüÈ­¹øÈ£  (#PCDATA)>
<!ELEMENT ÆÑ½º¹øÈ£  (#PCDATA)>
<!ELEMENT ÀüÀÚ¿ìÆí¹øÈ£ (#PCDATA)>

<!--  È£Àû°ü°è          -->

<!ELEMENT È£Àû°ü°è  (È£ÁÖ¼º¸í,°ü°è)>
<!ELEMENT È£ÁÖ¼º¸í  (#PCDATA)>
<!ELEMENT °ü°è  (#PCDATA)>

<!--  ÇзÂ, °æ·Â, Ư±â, ÀÚ°Ý    -->

<!ELEMENT Çз  (%m.lib;)>
<!ELEMENT °æ·Â  (%m.lib;)>
<!ELEMENT Ư±â  (%m.lib;)>
<!ELEMENT ÀÚ°Ý  (%m.lib;)>

<!ELEMENT ³»¿ë  (#PCDATA)>
<!ELEMENT ºñ°í  (#PCDATA)>   

5.2 À̷¼­ XML ¹®¼­

´ÙÀ½Àº profile.xml ÀÌ´Ù.

<?xml version="1.0" encoding="euc-kr"?>
<?xml-stylesheet type="text/xsl" class='MIME' href="profile.xsl"?>
<!DOCTYPE À̷¼­ SYSTEM "profile.dtd" [
 <!ENTITY profile SYSTEM "profile.jpg" NDATA jpg>
]>
<À̷¼­>
 <À̸§ ¾ð¾î="ÇѱÛ">È«±æµ¿</À̸§>
 <»çÁø ID="pic01" NAME="profile"/>
 <Áֹεî·Ï¹øÈ£>
  <¾ÕÀÚ¸®>xxxxxx</¾ÕÀÚ¸®>
  <µÞÀÚ¸®>xxxxxxx</µÞÀÚ¸®>
 </Áֹεî·Ï¹øÈ£>
 <»ý³â¿ùÀÏ Ã¥·Â="¾ç·Â">
  <³ªÀÌ>18</³ªÀÌ>
  <³â>1800</³â>
  <¿ù>12</¿ù>
  <ÀÏ>30</ÀÏ>
 </»ý³â¿ùÀÏ>
 <ÁÖ¼Ò>
  ´ëÇѹα¹ ´ëÇѹα¹½Ã ´ëÇѹα¹µ¿
  <ÀüÈ­¹øÈ£>02-1234-5678</ÀüÈ­¹øÈ£>
  <ÀüÀÚ¿ìÆí¹øÈ£>kdhong@korea.com</ÀüÀÚ¿ìÆí¹øÈ£>
 </ÁÖ¼Ò>
 <È£Àû°ü°è>
  <È£ÁÖ¼º¸í>È«´ë°¨</È£ÁÖ¼º¸í>
  <°ü°è>¼­ÀÚ</°ü°è>
 </È£Àû°ü°è>
 <ÇзÂ>
  <³â>1810</³â>
  <¿ù>3</¿ù>
  <ÀÏ>2</ÀÏ>
  <³»¿ë>±æµ¿ ¼­´ç Á¹¾÷</³»¿ë>
 </ÇзÂ>
 <ÇзÂ>
  <³â>1820</³â>
  <¿ù>2</¿ù>
  <ÀÏ>25</ÀÏ>
  <³»¿ë>ÀÇÀû ±³À°¼Ò Á¹¾÷</³»¿ë>
  <ºñ°í>ÀÇÀû´ë 20(ÀÇ) 109</ºñ°í>
 </ÇзÂ>
 <°æ·Â>
  <³â>1821</³â>
  <³»¿ë>¾Ç´ö ±è´ë°¨ â°í Àýµµ</³»¿ë>
  <ºñ°í>½Ò 200 ¼¶</ºñ°í>
 </°æ·Â>
 <ÀÚ°Ý>
  <³â>1819</³â>
  <¿ù>10</¿ù>
  <ÀÏ>12</ÀÏ>
  <³»¿ë>ÀÇÀû ÀÚ°ÝÁõ 1±Þ</³»¿ë>
  <ºñ°í>ÀÇÀûÀη°ø´Ü</ºñ°í>
 </ÀÚ°Ý>
 <Ư±â>
  <³â>2001</³â>
  <¿ù>11</¿ù>
  <³»¿ë>´ëÇѹα¹ ±¹È¸ÀÇ»ç´ç Ãâ¸ô</³»¿ë>
  <ºñ°í>ºÎȰ(?)</ºñ°í>
 </Ư±â>
</À̷¼­>   

5.3 À̷¼­ XSL ½ºÅ¸ÀÏ½ÃÆ®

´ÙÀ½Àº profile.xsl ÀÌ´Ù.

¾Æ·¡ ¼Ò½º´Â profile.xsl ¿¡¼­ »ç¿ëµÈ ¾ÕºÎºÐÀÌ´Ù.

XSL ½ºÅ¸ÀÏ ½ÃÆ® ¶ÇÇÑ XML ¹®¼­´Ù.
<?xml version="1.0" encoding="euc-kr"?>

M$ÀÇ Tip¶õ¿¡ ¿Ã¶ó¿Â ³»¿ëÀ¸·Î, ½ºÅ¸ÀÏ ½ÃÆ® ³»¿¡¼­ °ø¹é(space)¸¦ Ç¥ÇöÇϱâ À§ÇÑ ¿£Æ¼Æ¼ ¼±¾ð 
HTML Æ÷¸ËÆÃÀ» »ç¿ëÇÒ °æ¿ì¿¡¸¸ °¡´ÉÇϸç, non-Validation À¸·Î 󸮵ȴÙ.
<!DOCTYPE xsl:stylesheet [
 <!ENTITY nbsp "&#160;" > 
]>

XSLTÀÇ ÃÖ»óÀ§ ¿¤¸®¸ÕÆ®
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
default´Â html ÀÌÁö¸¸ M$ÀÇ ProcessorÀÇ ¹ö±× ¶§¹®¿¡ Àӽ÷Π»ç¿ë(ý­¿¡¼³¸í)
<xsl:output method="xml" version="1.0" encoding="euc-kr"/>   

´ÙÀ½ ¼Ò½º´Â profile.xsl ¿¡¼­ °¡Àå ¸ÕÀú ¸ÅÄ¡µÇ´Â ÅÛÇø®Æ®·Î½á, °á°ú HTML ¹®¼­ÀÇ °ñ°ÝÀ» ÀÌ·é´Ù.

ÃÖÃÊÀÇ ÄÁÅýºÆ® ³ëµå´Â ¹®¼­ÀÇ ·çÆ®(/) À̹ǷÎ, ÃÖÃÊÀÇ ¸ÅÄ¡ ÅÛÇø®Æ®
<xsl:template match="/">
 <HTML>
 <HEAD>
 <STYLE>
  Link ¸¦ À§ÇÑ ½ºÅ¸ÀÏ ¼³Á¤
  a {text-decoration: none; color: black}
  a:hover {color: blue; font-weight: bold}
  
  ¿¬¶ôó¸¦ À§ÇÑ ½ºÅ¸ÀÏ ¼³Á¤
  .call {text-align: right; font-size: 15pt;}

  »çÁøÀÌ µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤(ÀϹÝÀûÀÎ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤)
  th, td{font-size: 10pt; background: #ccffff}

  "À̷¼­" ÀÇ Á¦¸ñÀÌ µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .top {font-size: 20pt; background: #ccffff}

  "¼º¸í, »ý³â¿ùÀÏ, ÁֹιøÈ£" °¡ µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .theader {font-size: 14pt; background: #ccffff}    

  "ÁÖ¼Ò, È£Àû°ü°è" °¡ µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .title {height: 30pt; font-size: 14pt; background: #ccffff} 

  "ÇзÂ, °æ·Â, ÀÚ°Ý, Ư±â" °¡ ÁÖ¼®À¸·Î µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .comment {height: 40pt; background: #ccffcc}    
  
  ½ÇÁ¦ XML µ¥ÀÌÅͰ¡ µé¾î°¥ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .titem {height: 30pt; background: #ffffcc}     
  
  ½ÇÁ¦ XML µ¥ÀÌÅͰ¡ ¾øÀ»¶§ÀÇ Table CellÀÇ ½ºÅ¸ÀÏ ¼³Á¤
  .null {}             
 </STYLE>
 </HEAD>
 <BODY>
  ´ÙÀ½ ¸ÅÄ¡ÇÒ ÅÛÇø®Æ® ¼±ÅÃ(À̺κп¡ ³¢¿ö³Ö¾îÁú µ¥ÀÌÅ͸¦ À§ÇØ)
  <xsl:apply-templates select="À̷¼­"/>
 </BODY>
 </HTML>
</xsl:template>

´ÙÀ½È¸¿¡ °è¼Ó......

6. XSL Stylesheet ¿¹Á¦ (2)

6.1 À̷¼­ XSL ½ºÅ¸ÀÏ½ÃÆ®

´ÙÀ½Àº profile.xsl ÀÌ´Ù.

´ÙÀ½ ¼Ò½º´Â À̷¼­ÀÇ Ç¥¸¦ ±¸¼ºÇϱâ À§ÇÑ ÅÛÇø®Æ®·Î½á, Ç¥ÀÇ ÁÖ¼®ºÎºÐ°ú ¸ÅÄ¡½Ãų ÅÛÇø®Æ® ¼ø¼­¸¦ ó¸®ÇÑ´Ù.

ÅÛÇø®Æ®¸¦ ¸ÅÄ¡½Ãų ¼ø¼­¿Í À§Ä¡ ±×¸®°í ¹Ýº¹¿¡ À¯ÀÇÇÑ´Ù.

[ ! ] xsl:apply-templates À» »ç¿ëÇÏ¿© ¸ÅÄ¡ ½Ãų ÅÛÇø®Æ®°¡ ¾øÀ»°æ¿ì, ÇÏÀ§ µ¥ÀÌÅ͵éÀº ¸ðµÎ ÇϳªÀÇ ÅØ½ºÆ® µ¥ÀÌÅͷΠó¸® °¡´ÉÇÏ´Ù. Áï, ÄÁÅýºÆ® ³ëµå°¡ ÇÏÀ§ Àüü ³ëµå ¼ÂÀ» ÀǹÌÇϰí xsl:value-of ¸¦ »ç¿ëÇѰͰú °°Àº Àǹ̰¡ µÈ´Ù. º¸Åë ÇÏÀ§ ¿¤¸®¸ÕÆ®°¡ Àý´ë ¾øÀ»°æ¿ì xsl:value-of ¸¦ »ç¿ëÇϰí, ÇÏÀ§ ÅÛÇø®Æ® ±¸¼ºÀ» À§ÇØ xsl:apply-templates À» »ç¿ëÇÑ´Ù. xsl:apply-templatesÀ» »ç¿ëÇÒ°æ¿ì ¸ÅÄ¡µÉ ÅÛÇø®Æ®¿¡ ÁÖÀÇÇÏÁö ¾ÊÀ¸¸é ¾î¶×ÇÑ °á°ú°¡ ³ª¿À±âµµ ÇÑ´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå´Â profile.xml ¹®¼­ÀÇ ·çÆ®ÀÎ "À̷¼­" ·Î½á, ÅÛÇø®Æ® ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "À̷¼­">
 <TABLE width="620pt" border='1' CELLSPACING="0" CELLPADDING="0" align="center">
   
 "¿¬¶ôó:" ¿Í ¹®¼­¿¡¼­ ù¹øÂ°·Î Á¢±ÙµÇ´Â ÀüÈ­¹øÈ£ °ªÀ» ÀÔ·Â(À§ ÆÁ[!] ÂüÁ¶)
 <DIV class="call">¿¬ ¶ô ó : <xsl:apply-templates select="//ÀüÈ­¹øÈ£[1]"/></DIV>

 '»çÁø' ÅÛÇø®Æ®¿Í "ÀÌ ·Â ¼­" ÁÖ¼® ÀÔ·Â
 <TR>
  <TD colspan='3' rowspan='4' width="15%" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "»çÁø" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="»çÁø"/>
  </TD>
  <TD class="top" colspan='5' height="50pt" style="font-weight: bold; text-align: center">
   ÀÌ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;·Â&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¼­
  </TD>
 </TR>

 "¼º ¸í", "(ÀÎ)", "Áֹεî·Ï¹øÈ£" ÁÖ¼® ÀÔ·Â, 'À̸§' ÅÛÇø®Æ® ÀÔ·Â
 <TR>
  <TD width='15%' rowspan='2' class="theader" style="text-align: center">
   ¼º&nbsp;&nbsp;&nbsp;&nbsp;¸í
  </TD>    
  <TD width='35%' rowspan='2' class="theader" style="text-align: right">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "À̸§" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="À̸§"/>
   (ÀÎ)
  </TD>
  <TD width='40%' height="25pt" colspan='3' class="theader" style="text-align: center">
   ÁÖ ¹Î µî ·Ï ¹ø È£
  </TD>
 </TR>
 
 'Áֹεî·Ï¹øÈ£' ÅÛÇø®Æ® ÀÔ·Â
 <TR>
  <TD width='40%' height="25pt" colspan='3' class="theader" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "Áֹεî·Ï¹øÈ£" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="Áֹεî·Ï¹øÈ£"/>
  </TD>
 </TR>

 '»ý³â¿ùÀÏ' ÅÛÇø®Æ® ÀÔ·Â
 <TR>
  <TD colspan='5' height="50pt" class="theader" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "»ý³â¿ùÀÏ" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="»ý³â¿ùÀÏ"/>
  </TD>
 </TR>

 "ÁÖ ¼Ò" ÁÖ¼® ÀÔ·Â, 'ÁÖ¼Ò' ÅÛÇø®Æ® ÀÔ·Â
 <TR>
  <TD colspan='3' class="title" style="text-align: center">
   ÁÖ&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;¼Ò
  </TD>
  <TD colspan='5' class="title" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "ÁÖ¼Ò" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="ÁÖ¼Ò"/>
  </TD>
 </TR>

 "È£Àû°ü°è", "È£ÁÖ¿ÍÀÇ °ü°è", "È£ÁÖ¼º¸í" ÁÖ¼®ÀÔ·Â, 'È£Àû°ü°è/°ü°è', 'È£Àû°ü°è/È£ÁÖ¼º¸í' ÅÛÇø®Æ® ÀÔ·Â
 <TR>
  <TD colspan='3' class="title" width="10%" style="text-align: center">
   È£Àû°ü°è
  </TD>
  <TD class="title" width="17%" style="text-align: center">
   È£ÁÖ¿ÍÀÇ °ü°è
  </TD>
  <TD class="title" width="30%" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "È£Àû°ü°è/°ü°è" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="È£Àû°ü°è/°ü°è"/>
  </TD>
  <TD class="title" width="13%" style="text-align: center">
   È£ ÁÖ ¼º ¸í
  </TD>
  <TD colspan='2' class="title" style="text-align: center">
   ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "È£Àû°ü°è/È£ÁÖ¼º¸í" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
   <xsl:apply-templates select="È£Àû°ü°è/È£ÁÖ¼º¸í"/>
  </TD>
 </TR>

 "³â¿ùÀÏ", "Çз»çÇ×", "¹ß·Éû" ÁÖ¼® ÀÔ·Â
 <TR>
  <TD class="comment" colspan='3' style="text-align: center">
   ³â ¿ù ÀÏ
  </TD>
  <TD class="comment" colspan='4' style="font-weight: bold; text-align: center">
   ÇÐ ·Â »ç Ç×
  </TD>
  <TD class="comment" width="18%" style="text-align: center">
   ¹ß ·É û
  </TD>
 </TR>

 ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "ÇзÂ" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
 <xsl:apply-templates select="ÇзÂ"/>
 
 "À̷¼­"ÀÇ ÇÏÀ§¿¡ "ÀÚ°Ý" ³ëµå°¡ Çϳª ÀÌ»ó Á¸ÀçÇϸé "ÀÚ°Ý»çÇ×" ÁÖ¼® ÀÔ·Â
 <xsl:if test="count(ÀÚ°Ý) > 0">
  <TR>
   <TD class="comment" colspan='8' style="font-weight: bold; text-align: center">
    ÀÚ °Ý »ç Ç×
   </TD>
  </TR>
 </xsl:if>
 
 ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "ÀÚ°Ý" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
 <xsl:apply-templates select="ÀÚ°Ý"/>
 
 "À̷¼­"ÀÇ ÇÏÀ§¿¡ "Ư±â" ³ëµå°¡ Çϳª ÀÌ»ó Á¸ÀçÇϸé "Ư±â»çÇ×" ÁÖ¼® ÀÔ·Â
 <xsl:if test="count(Ư±â) > 0">
  <TR>
   <TD class="comment" colspan='8' style="font-weight: bold; text-align: center">
    Ư ±â »ç Ç× 
   </TD>
  </TR>
 </xsl:if>
 
 ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "Ư±â" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
 <xsl:apply-templates select="Ư±â"/>
 
 "À̷¼­"ÀÇ ÇÏÀ§¿¡ "°æ·Â" ³ëµå°¡ Çϳª ÀÌ»ó Á¸ÀçÇϸé "°æ·Â»çÇ×" ÁÖ¼® ÀÔ·Â
 <xsl:if test="count(°æ·Â) > 0">
  <TR>
   <TD class="comment" colspan='8' style="font-weight: bold; text-align: center">
    °æ ·Â »ç Ç× 
   </TD>
  </TR>
 </xsl:if>
 
 ÇöÀç À§Ä¡¿¡ ´ÙÀ½ ÅÛÇø®Æ®¸¦ ¸ÅÄ¡("À̷¼­"ÀÇ ÇÏÀ§ ³ëµåÁß "°æ·Â" ¿¡ ÇØ´çÇÏ´Â ÅÛÇø®Æ® ¸ÅÄ¡)
 <xsl:apply-templates select="°æ·Â"/>
 
 </TABLE>
</xsl:template>

Ưº°ÇÑ Ã³¸®¸¦ ¿äÇÏ´Â ºÎºÐÀº À¯Áöº¸¼ö¸¦ À§ÇØ º°µµÀÇ ÅÛÇø®Æ®·Î ±¸¼ºÇÑ´Ù.

[ ! ] XSLTÀÇ ÇÔ¼ö·Î ÀÖ´Â unparsed-entity-uri´Â ¿£Æ¼Æ¼À̸§¿¡ µû¸¥ ¿£Æ¼Æ¼ °ªÀ» ¸®ÅÏÇÏ´Â ÇÔ¼ö´Ù. º¸Åë, ¿ÜºÎ ¿£Æ¼Æ¼¸¦ ¼±¾ðÇÑÈÄ À̸¦ ÂüÁ¶ÇÒ¶§ »ç¿ëÇÑ´Ù. ¼Ó¼º¿¡¼­ ¸¹ÀÌ »ç¿ëÇϴµ¥ ¼Ó¼ºÅ¸ÀÔÀ» ENTITY ·Î Çϰí, ¼Ó¼º°ª¿¡ ¿£Æ¼Æ¼ À̸§À» »ç¿ëÇÑ´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "»çÁø" À¸·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "»çÁø">
 <img>
  IMG ¿¤¸®¸ÕÆ®ÀÇ ¼Ó¼ºÀ¸·Î "ID" ¸¦ »ý¼ºÇÑ´Ù.
  <xsl:attribute name="ID">
   IMG ¿¤¸®¸ÕÆ® IDÀÇ ¼Ó¼º°ªÀ¸·Î ÇöÀç ÄÁÅýºÆ® ³ëµåÀÎ "»çÁø"ÀÇ ¼Ó¼º "ID" °ªÀ» ³Ö´Â´Ù.
   <xsl:value-of select="@ID"/>
  </xsl:attribute>
  IMG ¿¤¸®¸ÕÆ®ÀÇ ¼Ó¼ºÀ¸·Î "src" ¸¦ »ý¼ºÇÑ´Ù.
  <xsl:attribute name="src">
   IMG ¿¤¸®¸ÕÆ® srcÀÇ ¼Ó¼º°ªÀ¸·Î ÇöÀç ÄÁÅýºÆ® ³ëµåÀÎ "»çÁø"ÀÇ ¼Ó¼º "NAME" °ªÀ» ³Ö´Â´Ù.(À§ ÆÁ[!] ÂüÁ¶)
   <xsl:value-of select="unparsed-entity-uri(@NAME)"/>   
  </xsl:attribute>
 </img>  
</xsl:template>

´ÙÀ½ ¼Ò½º´Â °á°ú HTML ÀÇ ¼Ó¼º°ªÀ» ¿¬°á½ÃŰ´Â ÅÛÇø®Æ®´Ù.

[ ! ] xsl:text¸¦ »ç¿ëÇÑ ÅØ½ºÆ®¹®ÀÚ¿­Àº ÀϹÝÀûÀ¸·Î ÅØ½ºÆ®¸¦ ÀÔ·ÂÇÏ´Â°Í º¸´Ù ¹®ÀÚ¿­ ¿¬°á½Ã¿¡ È­ÀÌÆ®½ºÆäÀ̽º(white-space) 󸮿¡ ¿ëÀÌÇÏ´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "À̸§" À¸·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "À̸§">
 <a>
  A ¿¤¸®¸ÕÆ®ÀÇ ¼Ó¼ºÀ¸·Î "HREF" ¸¦ »ý¼ºÇÑ´Ù.
  <xsl:attribute name="HREF">
   "mailto:" °ªÀ» A ¿¤¸®¸ÕÆ® HREFÀÇ ¼Ó¼º°ªÀ¸·Î ÀÔ·Â
   <xsl:text>mailto:</xsl:text>
   ¹®¼­¿¡¼­ ù¹øÂ°·Î Á¢±ÙµÇ´Â "ÀüÀÚ¿ìÆí¹øÈ£"¸¦ A ¿¤¸®¸ÕÆ® HREFÀÇ ¼Ó¼º°ªÀ¸·Î À̾ ÀÔ·Â
   <xsl:value-of select="//ÀüÀÚ¿ìÆí¹øÈ£[1]"/>
  </xsl:attribute>
  A ¿¤¸®¸ÕÆ®ÀÇ ³»ºÎ °ªÀ¸·Î, ÇöÀç ÄÁÅýºÆ® ³ëµåÀÎ "À̸§" ³ëµåÀÇ ÅØ½ºÆ® µ¥ÀÌÅͰªÀ» ÀÔ·Â
  <xsl:value-of select="."/>
 </a>
</xsl:template>

´ÙÀ½ ¼Ò½º´Â xsl:text¿Í xsl:value-of¸¦ »ç¿ëÇØ ¿©·¯ ¹®ÀÚ¿­À» ÇϳªÀÇ ¹®ÀÚ¿­·Î ¸¸µå´Â ÅÛÇø®Æ®´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "»ý³â¿ùÀÏ" À¸·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "»ý³â¿ùÀÏ">
 <xsl:text>»ý³â¿ùÀÏ</xsl:text>
 <xsl:text>¼­±â</xsl:text>
 <xsl:value-of select = "³â"/>
 <xsl:text>³â</xsl:text>
 <xsl:value-of select = "¿ù"/>
 <xsl:text>¿ù</xsl:text>
 <xsl:value-of select = "ÀÏ"/>
 <xsl:text>ÀÏ»ý</xsl:text>
 <xsl:text>(¸¸ </xsl:text>
 <xsl:value-of select = "³ªÀÌ"/>
 <xsl:text> ¼¼)</xsl:text>
</xsl:template>

´ÙÀ½ ¼Ò½º´Â xsl:value-of¸¦ »ç¿ëÇØ ¿©·¯ ¹®ÀÚ¿­À» ÇϳªÀÇ ¹®ÀÚ¿­·Î ¸¸µå´Â ÅÛÇø®Æ®´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "»ý³â¿ùÀÏ" À¸·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "Áֹεî·Ï¹øÈ£">
 <xsl:value-of select = "¾ÕÀÚ¸®"/> - 
 <xsl:value-of select = "µÞÀÚ¸®"/>     
</xsl:template>

´ÙÀ½ ¼Ò½º´Â ÇÊ¿äÇÑ ³ëµå¸¸ ÀÔ·ÂÇÏ´Â ÅÛÇø®Æ®´Ù.

[ ! ] Mixed Content Áï, ¿¤¸®¸ÕÆ®¿Í #PCDATA°¡ ÇÔ²² ÇüÁ¦³ëµå·Î Á¸ÀçÇÏ´Â °æ¿ì, xsl:for-each¿Í xsl:choose ¸¦ »ç¿ëÇØ ¿øÇÏ´Â ³ëµå¸¸ ó¸®ÇÒ ¼ö ÀÖ´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "ÁÖ¼Ò" À¸·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "ÁÖ¼Ò">
 node()´Â ÇöÀç ÄÁÅýºÆ® ³ëµå Áï, "ÁÖ¼Ò"ÀÇ ÇÏÀ§ ³ëµåµéÀ» ÀǹÌÇÑ´Ù.(À§ ÆÁ[!] ÂüÁ¶)
 <xsl:for-each select="node()">
  <xsl:choose>
   ¿¤¸®¸ÕÆ® ³ëµåÀÏ °æ¿ì´Â ¾Æ¹«°Íµµ ¾ÊÇÑ´Ù.
   <xsl:when test="local-name(.)='ÀüÈ­¹øÈ£'"/>
   <xsl:when test="local-name(.)='ÀüÀÚ¿ìÆí¹øÈ£'"/>
   ÀÏ¹Ý ÅØ½ºÆ®(#PCDATA) °æ¿ì¿¡´Â ÇöÀç ÄÁÅýºÆ® Áï, text() ³ëµå¸¦ ÀÔ·ÂÇÑ´Ù.
   <xsl:otherwise>
    <xsl:value-of select="."/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:for-each>
</xsl:template>

´ÙÀ½ ¼Ò½º´Â ¹Ýº¹µÇ´Â ÆÐÅÏÀÇ Ã³¸®¸¦ À§ÇÑ ÅÛÇø®Æ®´Ù.

[ ! ] xsl:value-of ÀÇ ¼±Åà ³ëµå°ªÀ̳ª xsl:apply-templates ÀÇ ¼±ÅÃµÉ ÅÛÇø®Æ®°¡ ¾ø´Ù¸é, ¾Æ¹«°ªµµ ÀԷµÇÁö ¾Ê´Â´Ù. ±×·¯¹Ç·Î ´Ü¸»(Termial) ³ëµå 󸮽ÿ¡´Â xsl:if ³ª xsl:choose ¸¦ »ç¿ëÇÒ Çʿ䰡 ¾ø´Ù.

ÇöÀçÀÇ ÄÁÅýºÆ® ³ëµå°¡ "ÇзÂ" ȤÀº "°æ·Â" ȤÀº "ÀÚ°Ý" ȤÀº "Ư±â" ·Î½á ÅÛÇø®Æ®¿¡ ¸ÅÄ¡µÈ´Ù.
<xsl:template match = "ÇзÂ|°æ·Â|ÀÚ°Ý|Ư±â">
 <TR>
  <TD class='titem' width="7%" style="text-align: center">
   ÄÁÅýºÆ® ³ëµåÀÇ ÇÏÀ§ ³ëµå°¡ "³â" ³ëµå°¡ ¾Æ´Ï¸é "-"À» ÀÔ·Â
   <xsl:if test="true()!=current()[³â]">
    <div class="null">-</div>
   </xsl:if>
   ÄÁÅýºÆ® ³ëµåÀÇ ÇÏÀ§ ³ëµåÁß "³â" ³ëµå°¡ ÀÖÀ¸¸é °ªÀ» ÀÔ·Â
   <xsl:value-of select = "³â"/>
  </TD>
  <TD class='titem' width="4%" style="text-align: center">
   <xsl:if test="true()!=current()[¿ù]">
    <div class="null">-</div>
   </xsl:if>
   <xsl:value-of select = "¿ù"/>
  </TD>
  <TD class='titem' width="4%" style="text-align: center">
   <xsl:if test="true()!=current()[ÀÏ]">
    <div class="null">-</div>
   </xsl:if>
   <xsl:value-of select = "ÀÏ"/>
  </TD>
  <TD class='titem' colspan='4' style="text-align: center">
   <xsl:if test="true()!=current()[³»¿ë]">
    <div class="null">-</div>
   </xsl:if>
   <xsl:value-of select = "³»¿ë"/>
  </TD>
  <TD class='titem' width="15%" style="text-align: center">
   <xsl:if test="true()!=current()[ºñ°í]">
    <div class="null">-</div>
   </xsl:if>
   <xsl:value-of select = "ºñ°í"/>
  </TD>
 </TR>
</xsl:template>

</xsl:stylesheet>   

7. XSL Stylesheet ¿¹Á¦ (3)

À̹ø¿£ º» °­ÁÂÀÇ ½ºÅ¸ÀÏ ½ÃÆ®¸¦ »ìÆìº»´Ù.

7.1 °­ÁÂ DTD

´ÙÀ½ °­Á DTD´Â Internet Explorer ¿¡ ÀûÇÕÇϵµ·Ï ¼³°èµÇ¾úÀ¸¸ç, ÃÖÀûÈ­µÈ DTD´Â ¾Æ´Ï´Ù.

´ÙÀ½Àº °­ÁÂ.dtd ÀÌ´Ù.

<?xml version="1.0" encoding="euc-kr"?>
<!-- copyright ¨Ï HyoungMoon, Lee -->
<!-- darkness@nate.com -->
<!-- http://home.kcnet5.com/darkness/ -->
<!-- draft  date : 2000/12/20  -->
<!-- update date : 2001/01/05  -->

<!NOTATION jpg PUBLIC "">

<!ENTITY % e.ph "´Ü¶ô|±×¸²±×·ì|¹®ÀÚµ¥ÀÌÅÍ|ÆÁ|Ç¥">
<!ENTITY % m.ph "#PCDATA|°­Á¶|¿¬°á">

<!ENTITY % a.ep "»ö CDATA #IMPLIED
   ¹è°æ»ö CDATA #IMPLIED
   µÎ²² CDATA #IMPLIED
   ½ºÅ¸ÀÏ CDATA #IMPLIED">

<!ENTITY % a.link "À§Ä¡ CDATA #IMPLIED">


<!-- Top-level ELEMENT  -->
<!-- =================  -->
<!ELEMENT °­Á (Á¦¸ñ,¸ñÂ÷?,³»¿ë,ÀúÀÛ±Ç?)>

<!ELEMENT ³»¿ë (Àå)+>
<!ELEMENT Àå (Á¦¸ñ,(%e.ph;)*,Àý*)>
<!ATTLIST Àå ¸ñÂ÷ CDATA #IMPLIED>

<!ELEMENT Àý (Á¦¸ñ,(%e.ph;)*)>


<!-- List ELEMENT  -->
<!-- ============  -->
<!ELEMENT ¸ñÂ÷ (¸ñ·Ï)+>
<!ELEMENT ¸ñ·Ï (#PCDATA)>


<!-- Table ELEMENT  -->
<!-- =============  -->
<!ELEMENT Ç¥ (Ç¥¸Ó¸®?,Ç¥²¿¸®?,(Ç¥³»¿ë*|Çà+))>
<!ELEMENT Ç¥¸Ó¸® (Çà)+>
<!ELEMENT Ç¥²¿¸® (Çà)+>
<!ELEMENT Ç¥³»¿ë (Çà)+>
<!ELEMENT Çà (¿­)+>
<!ELEMENT ¿­ (%e.ph;)*>


<!-- Image ELEMENT  -->
<!-- =============  -->
<!ELEMENT ±×¸²±×·ì (±×¸²|Á¦¸ñ)*>
<!ELEMENT ±×¸² EMPTY>
<!ATTLIST ±×¸² À̸§ ENTITY #IMPLIED>


<!-- block ELEMENT  -->
<!-- =============  -->
<!ELEMENT ÀúÀÛ±Ç (´Ü¶ô)+>

<!ELEMENT ´Ü¶ô (%m.ph;)*>
<!ATTLIST ´Ü¶ô %a.ep;>

<!ELEMENT ¹®ÀÚµ¥ÀÌÅÍ (%m.ph;)*>
<!ATTLIST ¹®ÀÚµ¥ÀÌÅÍ %a.ep;>

<!ELEMENT ÆÁ (%m.ph;)*>
<!ATTLIST ÆÁ %a.ep;>

<!ELEMENT Á¦¸ñ (#PCDATA)>
<!ATTLIST Á¦¸ñ %a.ep;>


<!-- inline ELEMENT  -->
<!-- ==============  -->
<!ELEMENT °­Á¶ (#PCDATA)>
<!ATTLIST °­Á¶ %a.ep;>

<!ELEMENT ¿¬°á (#PCDATA)>
<!ATTLIST ¿¬°á %a.ep; %a.link;>   

À§ÀÇ DTD´Â ´Ü¼øÇϸ鼭µµ º¹ÀâÇϱ⠶§¹®¿¡ ¹®¼­ÀÇ ±¸Á¶¸¦ ³ªÅ¸³»±â À§ÇÑ DTD DiagramÀ» ±×¸²1 °ú ±×¸²2 ¿¡ º¸ÀδÙ.

[ ! ] ÁÖÀÇ : DTD Diagram ¿¡´Â ¾îÆ®¸®ºäÆ® ¿¡ °ü°èµÇ´Â ºÎºÐÀÌ »ý·«µÇ¾î ÀÖ´Ù.

[±×¸² 1] °­Á DTD Diagram (1)

[±×¸² 2] °­Á DTD Diagram (2)

7.2 °­ÁÂ XML ¹®¼­

´ÙÀ½Àº °­Á¿¹Á¦.xml ÀÌ´Ù.

<?xml version="1.0" encoding="euc-kr"?>
<!-- copyright ¨Ï HyoungMoon, Lee  -->
<!-- darkness@nate.com  -->
<!-- http://home.kcnet5.com/darkness/  -->
<!-- draft  date : 2000/12/21  -->
<!-- update date : 2001/01/05  -->
<?xml-stylesheet type="text/xsl" class='MIME' href="°­ÁÂ.xsl"?>
<!DOCTYPE °­ÁÂ SYSTEM "°­ÁÂ.dtd"[
<!ENTITY ¸ñÂ÷ PUBLIC "-//Darkness//TEXT data//EN" "¸ñÂ÷.xml">
<!ENTITY ÀúÀÛ±Ç PUBLIC "-//Darkness//TEXT data//EN" "ÀúÀÛ±Ç.xml">
<!ENTITY ±×¸²01 SYSTEM "03.jpg"   NDATA     jpg>
<!ENTITY ±×¸²02 SYSTEM "04.jpg"   NDATA     jpg>
]>
<°­ÁÂ>

<Á¦¸ñ>XSL ±âÃÊ</Á¦¸ñ>
&¸ñÂ÷;
<³»¿ë>
 <Àå ¸ñÂ÷="02">
  <Á¦¸ñ>2. XSLT ÀÌÇØ(1)</Á¦¸ñ>
  <´Ü¶ô>XSLT Ç¥ÁØ¾È »óÅ¿¡ ´ëÇØ..</´Ü¶ô>
  <´Ü¶ô>XSLT´Â 1999³â ... <¿¬°á À§Ä¡="http://www.w3.org/TR/xslt">XSLT 1.0</¿¬°á> ... </´Ü¶ô>

  <Àý>
   <Á¦¸ñ>2.1 XSLT ó¸® °³³ä</Á¦¸ñ>
   <´Ü¶ô>ÅÛÇø®Æ®·êÀº XSLT Áö½Ã...</´Ü¶ô>

   <±×¸²±×·ì>
    <±×¸² À̸§="±×¸²01"/>
    <Á¦¸ñ>[ ±×¸² 1 ] XSLT ó¸® °³³ä</Á¦¸ñ>
   </±×¸²±×·ì>

   <´Ü¶ô>±×¸²1ÀÇ XSLT ó¸® °³³äµµ ... </´Ü¶ô>
  </Àý>
  <Àý>
   <Á¦¸ñ>2.2 ÅÛÇø®Æ® ¸ÅĪ(Template Matching)</Á¦¸ñ>
   <´Ü¶ô>ÅÛÇø®Æ® ¸ÅĪÀ̶õ ... </´Ü¶ô>
   
   <¹®ÀÚµ¥ÀÌÅÍ>
 <<°­Á¶ »ö="green">memo</°­Á¶>>
  <to><°­Á¶ »ö="black">È«±æµ¿</°­Á¶></to>
  <from><°­Á¶ »ö="black">±èµ¹¼è</°­Á¶></from>
  <say><°­Á¶ »ö="black">¾È³çÇϼ¼¿ä.</°­Á¶><say>
 </<°­Á¶ »ö="green">memo</°­Á¶>>

 <<°­Á¶ »ö="red">xsl:template</°­Á¶><°­Á¶ »ö="purple"> match</°­Á¶>=<°­Á¶ »ö="green">"memo"</°­Á¶>>
  ...
 </<°­Á¶ »ö="red">xsl:template</°­Á¶>>
   </¹®ÀÚµ¥ÀÌÅÍ>

   <´Ü¶ô>À§ÀÇ XML ¹®¼­´Â <°­Á¶ »ö="blue"><memo></°­Á¶>¿¤¸®¸ÕÆ®¸¦ ... </´Ü¶ô>
   
   <ÆÁ>¸ðµç XML ¹®¼­ÀÇ ·çÆ® ... </ÆÁ>

   ...

  </Àý>
  <Àý>
   <Á¦¸ñ>2.3 ÅÛÇø®Æ® ¿¹Á¦</Á¦¸ñ>
   <´Ü¶ô>´ÙÀ½Àº 2.2 ÀÇ XML ¹®¼­¿¡ ´ëÇÑ ¿ÏÀüÇÑ XSL ½ºÅ¸ÀÏ ½ÃÆ®¸¦ º¸¿©ÁØ´Ù.</´Ü¶ô>
   <¹®ÀÚµ¥ÀÌÅÍ>

   ...

   </¹®ÀÚµ¥ÀÌÅÍ>
   
   <´Ü¶ô>´ÙÀ½ ±×¸²2´Â À§ÀÇ ÅÛÇø®Æ®·êµéÀÌ Ã³¸®µÇ´Â °úÁ¤À» º¸ÀδÙ.</´Ü¶ô>
   <±×¸²±×·ì>
    <±×¸² À̸§="±×¸²02"/>
    <Á¦¸ñ>[ ±×¸² 2 ] ÅÛÇø®Æ® ¸ÅĪ °úÁ¤</Á¦¸ñ>
   </±×¸²±×·ì>

   ...

  </Àý>
 </Àå>
</³»¿ë>
&ÀúÀÛ±Ç;
</°­ÁÂ>   

[ ! ] ¸ñÂ÷¿Í ÀúÀ۱Ǵ À¯Áöº¸¼ö¹× µ¶¸³ÀûÀÎ »ç¿ëÀ» À§ÇØ °¢°¢ µ¶¸³µÈ ¹®¼­·Î ±¸¼ºÇÑ´Ù.

´ÙÀ½Àº ¸ñÂ÷.xml ÀÌ´Ù.

<?xml version="1.0" encoding="euc-kr"?>
<!-- copyright ¨Ï HyoungMoon, Lee  -->
<!-- darkness@nate.com  -->
<!-- http://home.kcnet5.com/darkness/  -->
<!-- draft  date : 2000/12/20  -->
<!-- update date : 2000/12/20  -->
<¸ñÂ÷>
 <¸ñ·Ï>XSL ±¸Á¶</¸ñ·Ï>
 <¸ñ·Ï>XSLT ÀÌÇØ(1)</¸ñ·Ï>
 <¸ñ·Ï>XSLT ÀÌÇØ(2)</¸ñ·Ï>
 <¸ñ·Ï>XPath ÀÌÇØ</¸ñ·Ï>
 <¸ñ·Ï>XSL Stylesheet ¿¹Á¦ (1)</¸ñ·Ï>
 <¸ñ·Ï>XSL Stylesheet ¿¹Á¦ (2)</¸ñ·Ï>
 <¸ñ·Ï>XSL Stylesheet ¿¹Á¦ (3)</¸ñ·Ï>
 <¸ñ·Ï>XSL Stylesheet ¿¹Á¦ (4)</¸ñ·Ï>
</¸ñÂ÷>   

´ÙÀ½Àº ÀúÀÛ±Ç.xml ÀÌ´Ù.

<?xml version="1.0" encoding="euc-kr"?>
<!-- copyright ¨Ï HyoungMoon, Lee  -->
<!-- darkness@nate.com  -->
<!-- http://home.kcnet5.com/darkness/  -->
<!-- draft  date : 2001/01/05  -->
<!-- update date : 2001/01/05  -->
<ÀúÀÛ±Ç>
 <´Ü¶ô>º» °­Á³»¿ë°ú µ¥ÀÌÅÍÀÇ ÀúÀÛ±Ç ¹× ¼ÒÀ¯±ÇÀº 
 <¿¬°á À§Ä¡="mailto:darkness@nate.com?subject=°­Á¹®ÀÇ">ÀÌÇü¹®</¿¬°á> ¿¡°Ô ÀÖ½À´Ï´Ù.
 °³ÀÎ »ç¿ëÀÚ°¡ ÀÚ·áÀÇ ¹èÆ÷½Ã ¹«´Ü ¼öÁ¤À» ±ÝÁöÇϸç, ¹Ýµå½Ã Ãâó¸¦ ¸í½ÃÇØ¾ß ÇÕ´Ï´Ù.
 ȸ»çÀÇ °æ¿ì ÀÚ·áÀÇ ¹«´Ü µî·Ï, ¹èÆ÷¹× ¼öÁ¤À» ±ÝÁöÇϸç, ¹Ýµå½Ã º»ÀÎÀÇ Çã¶ôÀ» ¹Þ¾Æ¾ß ÇÕ´Ï´Ù.
 ¶ÇÇÑ, º» ÀÚ·áÀÇ »ç¿ëÀ¸·Î »ý±â´Â ÇÇÇØµîÀÇ °üÇÑ Ã¥ÀÓÀº Àú¿¡°Ô ¾ø½À´Ï´Ù.</´Ü¶ô>
</ÀúÀÛ±Ç>   

7.3 °­Á XSL ½ºÅ¸ÀÏ½ÃÆ®

´ÙÀ½Àº °­ÁÂ.xsl ÀÌ´Ù.

´ÙÀ½ÀÇ °­Á XSL ½ºÅ¸ÀÏ½ÃÆ®¸¦ ±¸¼ºÇϱâ À§ÇØ ´ÙÀ½°ú °°Àº ´Ü°è¸¦ °ÅÄ£´Ù.

1. ±×¸²1 °ú ±×¸²2ÀÇ DTD DiagramÀ» ºÐ¼®ÇÑ´Ù.

¸ÕÀú ±×¸²1°ú ±×¸²2ÀÇ DTD DiagramÀ» ºÐ¼®Çغ¸¸é, "°­ÁÂ"´Â Å©°Ô "¸ñÂ÷", "³»¿ë", "ÀúÀÛ±Ç" À¸·Î ³ª´¶´Ù. ´ÙÀ½À¸·Î ¼¼ºÎÀûÀÎ »çÇ×Àº ½ÇÁ¦ Æ÷¸ËÆÃ¿¡ °ü·ÃÇÏ¿© ³ª´­¼ö ÀÖ´Ù. ¿¹¸¦ µé¾î ºí·° ´ÜÀ§ÀÎ "´Ü¶ô,±×¸²±×·ì,¹®ÀÚµ¥ÀÌÅÍ,ÆÁ,Ç¥" ¿Í ÀζóÀÎ ´ÜÀ§ "°­Á¶, ¿¬°á, #PCDATA" ·Î ³ª´­¼ö ÀÖ´Ù.

2. ºÐ¼®¿¡µû¶ó À¯Áöº¸¼ö¸¦ À§ÇÑ ÅÛÇø®Æ®¸¦ °èȹÇÑ´Ù.

"¸ñÂ÷"¿Í "ÀúÀÛ±Ç"Àº À¯Áö º¸¼ö¸¦ À§ÇØ °¢°¢ µ¶¸³ÀûÀÎ ÅÛÇø®Æ®¸¦ ÀÛ¼ºÇÏ°í ³ªÁß¿¡ ¿¬°á½ÃŲ´Ù. "³»¿ë"Àº "¸ñÂ÷", "ÀúÀÛ±Ç" °ú ´õºí¾î »ðÀ﵃ ¼ø¼­¸¦ °í·ÁÇϸç,ÇÏÀ§ ÅÛÇø®Æ®¸¦ ¸ÅνÃŲ´Ù. "´Ü¶ô"°ú "ÆÁ"Àº Æ÷¸ËÆÃ °èȹ¿¡ µû¶ó °°ÀÌ Ã³¸®Çϵµ·Ï ÅÛÇø®Æ®¸¦ ±¸¼ºÇϸç, "±×¸²±×·ì", "¹®ÀÚµ¥ÀÌÅÍ", "Ç¥" ¶ÇÇÑ °¢°¢ÀÇ ÅÛÇø®Æ®¸¦ ÀÛ¼ºÇÑ´Ù. Àû¿ëÇÒ Æ÷¸ËÆÃ ¸ðµâÀÌ HTML À̹ǷΠ¼Ó¼º°ªÀ¸·Î ó¸®ÇØ¾ß ÇÒ Á¤º¸´Â °¢°¢ ÅÛÇø®Æ®·Î ±¸¼ºÇϰí, Çʿ信 µû¶ó Àû¿ë °¡´ÉÇϵµ·Ï ÇÑ´Ù.

3. ½ºÅ¸ÀÏ ½ÃÆ®ÀÇ ½ºÅ¸ÀÏ ¼Ó¼º ¹× ±¸¼ºÀ» ¼³°èÇÑ´Ù.

³»¿ëÁß "Á¦¸ñ"Àº ¿©·¯¹ø ¹Ýº¹µÇ°í °¢°¢ÀÇ Àǹ̿¡ µû¶ó ´Ù¸¥ ÇüÅÂÀÇ ÅÛÇø®Æ®¸¦ ÀÛ¼ºÇÑ´Ù. ¼Ó¼ºÀ» À§ÇÑ ÅÛÇø®Æ®´Â HTMLÀÇ Style ¼Ó¼ºÀ» »ç¿ëÇÏ¸ç °¢°¢ µ¶¸³µÇµµ·Ï À¯ÁöÇÑ´Ù. °á°ú Æ÷¸ËÆÃ ¸ðµâ·ÎÀÇ º¯È¯½ÃÀÇ »óŸ¦ À§ÇØ Æ÷¸ËÆÃ ¸ðµâÀÇ ³¡¿¡ &#13;&#10;¸¦ »ç¿ëÇÏ¿© ´Ü¶ô ó¸® ÇÑ´Ù. ºí·° ´ÜÀ§ÀÇ ½ºÅ¸ÀÏ Ã³¸®´Â À¯Áö º¸¼ö¸¦ À§ÇØ °¢°¢ HTMLÀÇ Class ¼Ó¼ºÀ» »ç¿ëÇÏ¿© Á¤ÀÇÇϰí ÃÖ»óÀ§¿¡¼­ ½ºÅ¸ÀÏÀ» Á¤ÀÇÇϵµ·Ï ÇÑ´Ù. ÀζóÀÎ ´ÜÀ§ÀÇ Ã³¸®´Â "´Ü¶ô" ¹× "ÆÁ", "¹®ÀÚµ¥ÀÌÅÍ" ³»ºÎ¿¡¼­ 󸮵ǵµ·Ï ÇÑ´Ù.

[ ! ] ½ºÅ¸ÀÏ ½ÃÆ®ÀÇ ±¸¼º°ú À¯Áöº¸¼ö¸¦ À§ÇÑ ÅÛÇø®Æ® ¼³°è´Â DTDÀÇ ±¸Á¶ Áï, DTD DiagramÀ» ºÐ¼®À» ÅëÇÏ¿© ÀÌ·ç¾îÁø´Ù.

´ÙÀ½È¸¿¡ °è¼Ó......

8. XSL Stylesheet ¿¹Á¦ (4)

8.1 À̷¼­ XSL ½ºÅ¸ÀÏ½ÃÆ®

´ÙÀ½Àº °­ÁÂ.xsl ÀÌ´Ù.

<?xml  : XML declaration
<xsl:..  : XSLT Element & Attribute ...
HTML  : HTML Element
CLASS  : HTML Attribute
¸ñÂ÷  : HTML Attribute value
¸ñÂ÷  : HTML Text Data value
&#13;&#10; : HTML Text Data value ( for HTML ELEMENT separation )
   
<?xml version="1.0" encoding="euc-kr"?>
 <!-- copyright ¨Ï HyoungMoon, Lee -->
 <!-- darkness@nate.com -->
 <!-- http://home.kcnet5.com/darkness/ -->
 <!-- draft  date : 2000/12/20  -->
 <!-- update date : 2001/01/05  --> 
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
 <xsl:output method="xml" version="1.0" encoding="euc-kr"/>
  
 <xsl:template match="/">
  <xsl:element name="HTML">
   <xsl:element name="STYLE">
    <xsl:text>
     .¸ñÂ÷{font-size:9pt; marin-top:10pt; margin-bottom:10pt}
     .¸ñÂ÷¼±ÅÃ{background-color:ccffff}
     .ÀúÀÛ±Ç{color:red; background-color:Beige}
     .ÀúÀ۱ǰ­Á¶{color:blue;background-color:LightCyan;text-align:center;}
     .±×¸²±×·ì{text-align: center;margin-bottom:20pt;font-weight:bold}
     .°­ÁÂÁ¦¸ñ{color:blue; font-size:20pt; font-family:Arial; font-weight:bold; margin-top:10pt; margin-bottom:10pt}
     .Àå{margin-top:10pt; margin-bottom:10pt}
     .Àý{margin-top:10pt; margin-bottom:10pt}
     .´Ü¶ô{margin-bottom:10pt}
     .ÆÁ{margin-bottom:10pt; background-color:yellow}
     .ÆÁ°­Á¶{color:red; font-weight:bold}
     .¹®ÀÚµ¥ÀÌÅÍ{color:blue;font-size:9pt}
     .Ç¥{margin-top:10pt; margin-bottom:10pt; margin-left:100pt; margin-right:100pt; table-layout:fixed}
     .Ç¥¸Ó¸®{text-weight:bold; color:red}
     .Ç¥³»¿ë{vertical-align:top}
     .ÀåÁ¦¸ñ{font-size:15pt;font-weight:bold;margin-bottom:10pt}
     .ÀýÁ¦¸ñ{font-size:13pt;font-weight:bold;margin-bottom:10pt}
     BODY{margin-left: 30pt;margin-right: 30pt;text-align:justify; font-size:11pt;}
    </xsl:text>
   </xsl:element>   
   <xsl:element name="BODY">
    <xsl:apply-templates select="°­ÁÂ"/>
   </xsl:element>
  </xsl:element>
 </xsl:template>


 <!--================= ¸ñÂ÷ =================-->


 <xsl:template name="¸ñÂ÷¸Þ´º">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>¸ñÂ÷</xsl:text>
   </xsl:attribute>
   <xsl:for-each select="//¸ñÂ÷/¸ñ·Ï">
    <xsl:element name="DIV">
     <xsl:element name="SPAN">
      <xsl:if test="position()=number(//Àå/@¸ñÂ÷)">
       <xsl:attribute name="CLASS">
        <xsl:text>¸ñÂ÷¼±ÅÃ</xsl:text>
       </xsl:attribute>
      </xsl:if>
      <xsl:value-of select="position()"/>
      <xsl:text>. </xsl:text>
      <xsl:value-of select="."/>
     </xsl:element>
    </xsl:element>
    <xsl:text>&#13;&#10;</xsl:text>
   </xsl:for-each>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= ÀúÀÛ±Ç =================-->


 <xsl:template name="ÀúÀÛ±Ç">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>ÀúÀÛ±Ç</xsl:text>
   </xsl:attribute>
   <xsl:element name="DIV">
    <xsl:attribute name="CLASS">
     <xsl:text>ÀúÀ۱ǰ­Á¶</xsl:text>
    </xsl:attribute>
    <xsl:text>Copyright ¨Ï HyoungMoon, Lee</xsl:text>
   </xsl:element>
   <xsl:apply-templates select="//ÀúÀÛ±Ç/´Ü¶ô"/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= ÅÛÇø®Æ® =================-->


 <xsl:template match="°­ÁÂ">
  <xsl:text>&#13;&#10;</xsl:text>
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>°­ÁÂÁ¦¸ñ</xsl:text>
   </xsl:attribute>
   <xsl:value-of select="/°­ÁÂ/Á¦¸ñ"/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
  <xsl:call-template name="¸ñÂ÷¸Þ´º"/>
  <xsl:apply-templates select="³»¿ë"/>
  <xsl:call-template name="ÀúÀÛ±Ç"/>
 </xsl:template>

 <xsl:template match="³»¿ë">
  <xsl:apply-templates/>
 </xsl:template>

 <xsl:template match="Àå">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>Àå</xsl:text>
   </xsl:attribute>
   <xsl:apply-templates/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>

 <xsl:template match="Àý">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>Àý</xsl:text>
   </xsl:attribute>
   <xsl:apply-templates/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= ´Ü¶ô,ÆÁ,¹®ÀÚµ¥ÀÌÅÍ  =================-->


 <xsl:template match="´Ü¶ô|ÆÁ">
  <xsl:element name="DIV">
   <xsl:if test="local-name()='ÆÁ'">
    <xsl:attribute name="CLASS">
     <xsl:text>ÆÁ</xsl:text>
    </xsl:attribute>
    <xsl:element name="SPAN">
     <xsl:attribute name="CLASS">
      <xsl:text>ÆÁ°­Á¶</xsl:text>
     </xsl:attribute>
     <xsl:text>[ ! ] </xsl:text>
    </xsl:element>
   </xsl:if>
   <xsl:if test="local-name()='´Ü¶ô'">
    <xsl:attribute name="CLASS">
     <xsl:text>´Ü¶ô</xsl:text>
    </xsl:attribute>
   </xsl:if>
   <xsl:apply-templates select="@*"/>
   <xsl:for-each select="node()">
    <xsl:choose>
     <xsl:when test="local-name()='°­Á¶'">
      <xsl:element name="SPAN">
       <xsl:apply-templates select="@*"/>
       <xsl:apply-templates select="."/>
      </xsl:element>
     </xsl:when>
     <xsl:when test="local-name()='¿¬°á'">
      <xsl:element name="A">
       <xsl:apply-templates select="@*"/>
       <xsl:apply-templates select="."/>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates select="."/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:for-each>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>

 <xsl:template match="¹®ÀÚµ¥ÀÌÅÍ">
  <xsl:element name="PRE">
   <xsl:attribute name="CLASS">
    <xsl:text>¹®ÀÚµ¥ÀÌÅÍ</xsl:text>
   </xsl:attribute>
   <xsl:apply-templates select="@*"/>
   <xsl:for-each select="./node()">
    <xsl:choose>
     <xsl:when test="local-name()='°­Á¶'">
      <xsl:element name="SPAN">
       <xsl:apply-templates select="@*"/>
       <xsl:apply-templates select="."/>
      </xsl:element>
     </xsl:when>
     <xsl:when test="local-name()='¿¬°á'">
      <xsl:element name="A">
       <xsl:apply-templates select="@*"/>
       <xsl:apply-templates select="."/>
      </xsl:element>
     </xsl:when>
     <xsl:otherwise>
      <xsl:apply-templates select="."/>
     </xsl:otherwise>
    </xsl:choose>
   </xsl:for-each>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>

 
 <!--================= ±×¸² =================-->
 

 <xsl:template match="±×¸²±×·ì">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>±×¸²±×·ì</xsl:text>
   </xsl:attribute>
   <xsl:element name="IMG">
    <xsl:attribute name="SRC">
     <xsl:value-of select="unparsed-entity-uri(±×¸²/@À̸§)"/>
    </xsl:attribute>
   <xsl:text>&#13;&#10;</xsl:text>
   </xsl:element>
   <xsl:element name="DIV">
    <xsl:value-of select="Á¦¸ñ"/>
   <xsl:text>&#13;&#10;</xsl:text>
   </xsl:element>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= ǥ =================-->


 <xsl:template match="Ç¥">
  <xsl:element name="TABLE">
   <xsl:attribute name="CLASS">
    <xsl:text>Ç¥</xsl:text>
   </xsl:attribute>
   <xsl:element name="THEAD">   
    <xsl:attribute name="CLASS">
     <xsl:text>Ç¥¸Ó¸®</xsl:text>
    </xsl:attribute>
    <xsl:apply-templates select="Ç¥¸Ó¸®"/>
   <xsl:text>&#13;&#10;</xsl:text>
   </xsl:element>
   <xsl:element name="TFOOT">   
    <xsl:attribute name="CLASS">
     <xsl:text>Ç¥²¿¸®</xsl:text>
    </xsl:attribute>
    <xsl:apply-templates select="Ç¥²¿¸®"/>
   <xsl:text>&#13;&#10;</xsl:text>
   </xsl:element>
   <xsl:element name="TBODY">   
    <xsl:attribute name="CLASS">
     <xsl:text>Ç¥³»¿ë</xsl:text>
    </xsl:attribute>
    <xsl:apply-templates select="Ç¥³»¿ë|Çà"/>
   <xsl:text>&#13;&#10;</xsl:text>
   </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
  </xsl:element>
 </xsl:template>

 <xsl:template match="Çà">
  <xsl:element name="TR">
   <xsl:apply-templates/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>

 <xsl:template match="¿­">
  <xsl:element name="TD">
   <xsl:apply-templates/>
  </xsl:element>
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= Á¦¸ñ =================-->


 <xsl:template match="Àå/Á¦¸ñ">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>ÀåÁ¦¸ñ</xsl:text>
   </xsl:attribute>
   <xsl:element name="SPAN">
    <xsl:apply-templates select="@*"/>
    <xsl:value-of select="."/>
   </xsl:element>
  </xsl:element>  
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>

 <xsl:template match="Àý/Á¦¸ñ">
  <xsl:element name="DIV">
   <xsl:attribute name="CLASS">
    <xsl:text>ÀýÁ¦¸ñ</xsl:text>
   </xsl:attribute>
   <xsl:element name="SPAN">
    <xsl:apply-templates select="@*"/>
    <xsl:value-of select="."/>
   </xsl:element>
  </xsl:element>  
  <xsl:text>&#13;&#10;</xsl:text>
 </xsl:template>


 <!--================= ¼Ó¼º =================-->


 <xsl:template match="@»ö">
  <xsl:attribute name="STYLE">
   <xsl:text>color:</xsl:text>
   <xsl:value-of select="."/>
  </xsl:attribute>
 </xsl:template>

 <xsl:template match="@µÎ²²">
  <xsl:attribute name="STYLe">
   <xsl:text>font-weight:</xsl:text>
   <xsl:value-of select="."/>
  </xsl:attribute>
 </xsl:template>

 <xsl:template match="@½ºÅ¸ÀÏ">
  <xsl:attribute name="style">
   <xsl:text>font-style:</xsl:text>
   <xsl:value-of select="."/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="@¹è°æ»ö">
  <xsl:attribute name="stylE">
   <xsl:text>background-color:</xsl:text>
   <xsl:value-of select="."/>
  </xsl:attribute>
 </xsl:template>
 

 <xsl:template match="@À§Ä¡">
  <xsl:attribute name="HREF">
   <xsl:value-of select="."/>
  </xsl:attribute>
  <xsl:attribute name="TARGET">
   <xsl:text>new</xsl:text>
  </xsl:attribute>
 </xsl:template>
</xsl:stylesheet>   

Copyright ¨Ï HyoungMoon, Lee

º» °­Á³»¿ë°ú µ¥ÀÌÅÍÀÇ ÀúÀÛ±Ç ¹× ¼ÒÀ¯±ÇÀº ÀÌÇü¹® ¿¡°Ô ÀÖ½À´Ï´Ù. °³ÀÎ »ç¿ëÀÚ°¡ ÀÚ·áÀÇ ¹èÆ÷½Ã ¹«´Ü ¼öÁ¤À» ±ÝÁöÇϸç, ¹Ýµå½Ã Ãâó¸¦ ¸í½ÃÇØ¾ß ÇÕ´Ï´Ù. ȸ»çÀÇ °æ¿ì ÀÚ·áÀÇ ¹«´Ü µî·Ï, ¹èÆ÷¹× ¼öÁ¤À» ±ÝÁöÇϸç, ¹Ýµå½Ã º»ÀÎÀÇ Çã¶ôÀ» ¹Þ¾Æ¾ß ÇÕ´Ï´Ù. ¶ÇÇÑ, º» ÀÚ·áÀÇ »ç¿ëÀ¸·Î »ý±â´Â ÇÇÇØµîÀÇ °üÇÑ Ã¥ÀÓÀº Àú¿¡°Ô ¾ø½À´Ï´Ù.

 

- ÀúÀÚ ÁÖ -

xml µ¥ÀÌÅ͸¦ º¯È¯ÇÑ ÇüÅÂ¶ó µ¥ÀÌÅͰ¡ ±úÁú ¼ö µµ ÀÖ½À´Ï´Ù.

µ¥ÀÌÅÍÀÇ ¿À·ù°¡ ÀÖÀ» °æ¿ì ÁúŸ ºÎŹÇÕ´Ï´Ù. ^^;

Çϵå Àú ¸Õ ÁöÇÏ ±¸¼®¿¡ ÃÄ ¹ÚÇô ÀÖ´ø ±ÛÀ» ¿ä ¾Æ·¡ °­ÀÚ ¿Ã¸° ÈĹè´ö¿¡ ºûÀ» º¸°Ô µÆ³×¿ä.

ÃßÈÄ ÀÚ¼¼ÇÑ °­Á ¶Ç ¿Ã¸®°Ú½À´Ï´Ù.