0
我有一个XML象下面这样:XSLT更新节点值根据病情
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<properties>
<entry key="user">1234</entry>
<entry key="name">sam</entry>
</properties>
我想改变的关键=“用户”标签的价值。如果key =“user”的初始值是1234,我希望输出xml中key =“user”的值为“test”,或者如果值为6666,则输出xml中key =“user”的值为“你好“使用xslt。 输出XML应该是这样的
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<properties>
<entry key="user">test</entry>
<entry key="name">sam</entry>
</properties>
我尝试使用此XSLT,但没有得到期望的输出。
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@key[.='1234']">
<xsl:attribute name="key">
<xsl:value-of select="'test'"/>
</xsl:attribute>
</xsl:template>
有人可以帮助我,因为我是XSLT的新手。
它很好用。非常感谢 –