xsl:copy、xsl:copy-of 記述例
xsl:copy記述例
ソースXML文書
<?xml version="1.0" encoding="Shift_JIS"?> <pet> <name eng="dog">犬</name> </pet>
XSLTスタイルシート
<?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="//name"/> </xsl:template> <xsl:template match="name"> <xsl:copy/> </xsl:template> </xsl:stylesheet>
結果XML文書
<?xml version="1.0" encoding="UTF-8"?> <name/>
xsl:copy-of記述例
ソースXML文書
<?xml version="1.0" encoding="Shift_JIS"?> <pet> <name eng="dog">犬</name> </pet>
XSLTスタイルシート
<?xml version="1.0" encoding="Shift_JIS"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates select="//name"/> </xsl:template> <xsl:template match="name"> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
結果XML文書
<?xml version="1.0" encoding="UTF-8"?> <name eng="dog">犬</name>
page revision: 1, last edited: 13 May 2008 11:13