我需要从我的 xml 文件中复制所有信息(实际上我需要将新信息添加到我的 xml 文件中)。
我使用标准模板:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
我写了测试 xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE products SYSTEM "products.dtd" >
<?xml-stylesheet type="text/xsl" href="../xsl/copy.xsl"?>
<products>
<category name="Audio And Video">
<subcategory name="Audio">
<good>
<producer>Dell</producer>
<model>QQ678</model>
<color>White</color>
<date_of_issue>12-12-2012</date_of_issue>
<not_in_stock>true</not_in_stock>
</good>
</subcategory>
<subcategory name="Video">
<good>
<producer>Samsung</producer>
<model>VH500</model>
<color>Black</color>
<date_of_issue>12-12-2006</date_of_issue>
<price>200</price>
</good>
<good>
<producer>Toshiba</producer>
<model>GP436</model>
<color>White</color>
<date_of_issue>12-12-2004</date_of_issue>
<not_in_stock>true</not_in_stock>
</good>
</subcategory>
</category>
<category name="Computers">
<subcategory name="Pocket">
<good>
<producer>HP</producer>
<model>rx371</model>
<color>Black</color>
<date_of_issue>31-01-2006</date_of_issue>
<not_in_stock>true</not_in_stock>
</good>
</subcategory>
</category>
</products>
当我在浏览器中打开这个 xml 文件时,我想我会看到相同的 xml 文件,但它会显示我:
所以我犯了错误。请帮我解决我的问题