´ÙÀ½ ÀÌÀü Â÷·Ê

10. Cocoon 1.8 ±âŸ»çÇ×

10.1 Cocoon 1.8 ÀÇ euc-kr Encoding

cocoon¿¡¼­ ÇѱÛÀ» º¸±â À§ÇØ $TOMCAT_HOME/webapps/cocoon/WEB-INF/cocoon.propertiesÀ» ¼öÁ¤ÇØ¾ß ÇÑ´Ù. vi ·Î cocoon.properties¸¦ ¿­°í XML Formatters ºÎºÐ¿¡ ÀÖ´Â HTML 4.0(strict) ºÎºÐÀ» ¼öÁ¤ÇÏ¸é µÈ´Ù. ´ÙÀ½Àº ¿¹ÀÌ´Ù.

# HTML 4.0 (strict)
formatter.text/html.doctype-public = ...
formatter.text/html.doctype-system = ...

À§ÀÇ ºÎºÐÀ» ã¾Æ¼­ ¾Æ·¡ÀÇ ¶óÀÎÀ» Ãß°¡ÇÏ¸é µÈ´Ù.

formatter.text/html.encoding = euc-kr

Áï, ´ÙÀ½Ã³·³ Ãß°¡ÇÏ¸é µÈ´Ù.

# HTML 4.0 (strict)
formatter.text/html.doctype-public = ...
formatter.text/html.doctype-system = ...
formatter.text/html.encoding = euc-kr

À§ÀÇ ÇÑ±Û ¹®Á¦¸¦ ÇØ°áÇϱâ À§ÇØ ¾öû³­ »ðÁúÀ» Çß´Ù. ¾ÆÆÄÄ¡ µîÀÇ »çÀÌÆ®ÀÇ ¸ÞÀϸµ ¸®½ºÆ®µîÀ» ã¾Æº¸¸é formatter.text/html/loose ºÎºÐÀ» ¼öÁ¤Ç϶ó°í ³ª¿Í ÀÖ¾ú±â ¶§¹®Àε¥..

Ȥ½Ã À̺κп¡ ´ëÇØ ´Ù¸¥ ´ë¾ÈÀ̳ª ¹æ¹ýÀ» ¾Ë°í ÀÖ´Ù¸é ÇÊÀÚ (nogadax@kldp.org)¿¡°Ô ¸ÞÀÏÀ» º¸³»ÁÖ¾úÀ¸¸é ÇÑ´Ù.

10.2 °£´ÜÇÑ xml ¸¸µé±â

À̺ÐÀº ±×·¸°Ô ±ÇÀåÇÒ ¸¸ÇÑ ºÎºÐÀÌ ¾Æ´Ï´Ù. ÇÊÀÚ°¡ ¸¸µç °£´ÜÇÑ ¿¹Á¦°¡ ÀÖ¾î ±×³É ¿Ã·Á ³õÀº °ÍÀ̹ǷΠ°ü½ÉÀÖ´Â ºÐ¸¸ ÂüÁ¶Çϱ⠹ٶõ´Ù.

¾Æ·¡ÀÇ ¿¹Á¦¸¦ Å×½ºÆ®Çϱâ À§ÇØ $TOMCAT_HOME/webapps/cocoon/servlets/ngd µð·ºÅ丮¸¦ ¸¸µé¾ú´Ù. Å×½ºÆ®¸¦ ¸ñÀûÀ¸·Î ÀÛ¼ºÇÑ ÆÄÀÏÀº µÎ°³À̸ç ngd-book.xml °ú ngd-book.xsl ÀÌ´Ù. ngd-book.xmlÀº °£´ÜÇÑ xml ÆÄÀÏÀ̸ç ngd-book.xsl ÆÄÀÏÀº xml ¹®¼­¸¦ ºê¶ó¿ìÁ®¿¡ µð½ºÇ÷¹ÀÌÇϱâ À§ÇÑ ÆÄÀÏÀÌ´Ù.

Å×½ºÆ®¸¦ À§ÇÑ URLÀº http://210.110.1xx.xx6/cocoon/servlets/ngd/ngd-book.xml ÀÌ´Ù.

´ÙÀ½Àº °£´ÜÇÑ ¿¹Á¦ÀÌ´Ù.


<?xml version="1.0" encoding="euc-kr"?>
<?xml-stylesheet href="ngd-book.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!DOCTYPE ngd-book [
 <!ELEMENT ngd-book (title?, name, dt, abstract, sect1)>
 <!ELEMENT title (#PCDATA)>
 <!ELEMENT name (#PCDATA)>
 <!ELEMENT dt (#PCDATA)>
 <!ELEMENT abstract (#PCDATA)>
 <!ELEMENT sect1 (#PCDATA)>
]>

<ngd-book>
 <title>Hello</title>
 <name>nogadax</name>
 <dt>/2000/11/11</dt>
 <abstract>TomcatÀº The Jakarta ProjectÀÇ »ê¹°À̸ç ȨÆäÀÌÁö´Â 
 http://jakarata.apache.org ÀÌ´Ù. Jakarta ProjectÀÇ ¸ñÇ¥´Â 
 ¿ÀÇ ¼Ò½ºÈ­µÇ¾î °³¹ßµÈ Java Ç÷§ÆûÀ» ±â¹ÝÀ¸·Î ÇÏ¿© »ó¿ë Ç°ÁúÀÇ 
 ¼­¹ö ¼Ö·ç¼ÇÀ» Á¦°øÇϱâ À§ÇÔÀÌ´Ù. ±âŸ XML °ü·Ã ÆÐÅ°ÁöÀÎ 
 cocoon ÀÇ È¨ ÆäÀÌÁö´Â http://xml.apache.orgÀÌ´Ù. CocoonÀº 
 XML ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© À̸¦ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁÖ´Â
 ÆÐÅ°Áö·Î ¼­¤©Ä¡°¡ °£ÆíÇÏ´Ù.
 </abstract>
 <sect1>
 TomcatÀº The Jakarta ProjectÀÇ »ê¹°À̸ç ȨÆäÀÌÁö´Â 
 http://jakarata.apache.org ÀÌ´Ù. Jakarta ProjectÀÇ ¸ñÇ¥´Â 
 ¿ÀÇ ¼Ò½ºÈ­µÇ¾î °³¹ßµÈ Java Ç÷§ÆûÀ» ±â¹ÝÀ¸·Î ÇÏ¿© »ó¿ë Ç°ÁúÀÇ 
 ¼­¹ö ¼Ö·ç¼ÇÀ» Á¦°øÇϱâ À§ÇÔÀÌ´Ù. ±âŸ XML °ü·Ã ÆÐÅ°ÁöÀÎ 
 cocoon ÀÇ È¨ ÆäÀÌÁö´Â http://xml.apache.orgÀÌ´Ù. CocoonÀº XML 
 ÆÄÀÏÀ» ¼­¹öÃø¿¡¼­ ó¸®ÇÏ¿© À̸¦ ºê¶ó¿ìÁ®¿¡ º¸¿©ÁÖ´Â
 ÆÐÅ°Áö·Î ¼­¤©Ä¡°¡ °£ÆíÇÏ´Ù.
 </sect1>
</ngd-book>

<?xml version="1.0" encoding="euc-kr"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="ngd-book">
   <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction>
   <html>
    <head>
     <title>
      <xsl:value-of select="title"/>
     </title>
    </head>
    <body bgcolor="#ffffff">
      <xsl:apply-templates/>
    </body>
   </html>
  </xsl:template>

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

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

  <xsl:template match="dt">
    <h4>
      <xsl:apply-templates/>
    </h4>
  </xsl:template>
  <xsl:template match="abstract">
    <hr/>
    <p>
    <i>
      <xsl:apply-templates/>
    </i>
    </p>
    <hr/>
  </xsl:template>
  <xsl:template match="sect1">
    <p>
      <xsl:apply-templates/>
    </p>
  </xsl:template>

</xsl:stylesheet>


´ÙÀ½ ÀÌÀü Â÷·Ê