본문 바로가기

IT/XSL

xsl에서 입력노드를 정확히 카피해서 출력하는 경우


Here's what you can do.  
        
###xml
 <xsl:template match="/">
              <xsl:apply-templates select="*"/>
            </xsl:template>
            <xsl:template match="@* | text()" mode="copy">
              <xsl:copy />
            </xsl:template>
            <xsl:template match="*" mode="copy">
              <xsl:copy>
                <xsl:apply-templates select="@*" mode="copy" />
                <xsl:apply-templates mode="copy" />
              </xsl:copy>
            </xsl:template> 
or            
###xml
   <xsl:template match="*" mode="copy">
              <xsl:copy>
                <xsl:copy-of select="@*"/>
                <xsl:copy-of select="*|text()"/>
              </xsl:copy>
            </xsl:template>
            <xsl:template match="a">
               <xsl:copy-of select="."/> <!-- copy a text -->
               ... enqueue manually...
            </xsl:template>