XMLファイルを変更したいのですが、このXMLファイルにいくつかの属性があり、これを変更したいのです。つまり、プロデューサーがVWの場合、国を「ドイツ」に変更したいのですが、これが私のXMLです。
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="example.xslt"?>
<Auto>
<lkw producer="VW" country="USA">
<name>Polo</name>
<price>$5955.2</price>
<color>red</color>
</lkw>
<lkw producer="Audi" country="germany">
<name>A8</name>
<price>$8955.2</price>
<color>black</color>
</lkw>
<lkw producer="BMW" country="USA">
<name>Polo</name>
<price>$6955.2</price>
<color>blue</color>
</lkw>
<lkw producer="VW" country="China">
<name>Pasat</name>
<price>$2955.2</price>
<color>red</color>
</lkw>
</Auto>
これが私のXSLTです。
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@producer[parent::VW]">
<xsl:attribute name="country">
<xsl:value-of select="'germany'"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
しかし、XMLファイルに変更はありません。XSLTのどこに間違いがあるのか教えてください。