xslt xsl:copy xsl:copy-of
copy 和 copy-of 结构是用来复制节点的。copy 元素只复制当前节点,不带子节点和属性。而 copy-of 却统统复制。
XSLT stylesheet 1
XML源码 <source> <p > Compare <B>these constructs</B>. </p> </source> 输出 <DIV> <B>copy-of : </B> <p > Compare <B>these constructs</B>. </p> </DIV> <DIV> <B>copy : </B> <p/> </DIV> <DIV> <B>value-of : </B> Compare these constructs. </DIV> 用HTML察看 copy-of : Compare these constructs. copy : value-of : Compare these constructs. | XSLT stylesheet <xsl:stylesheetversion = '1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:templatematch="p"> <DIV> <B> <xsl:text>copy-of : </xsl:text> </B> <xsl:copy-ofselect="."/> </DIV> <DIV> <B> <xsl:text>copy : </xsl:text> </B> <xsl:copy/> </DIV> <DIV> <B> <xsl:text>value-of : </xsl:text> </B> <xsl:value-ofselect="."/> </DIV> </xsl:template> </xsl: |