0
我有一个传入的XMl,我想要替换某个属性的值,如果它有一个特定的值。 “算法”被“转换”,这是在XML很多这样的节点属性的父元素替换XML中的属性值
传入XML:
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#pfx41d8ef22-e612-8c50-9960-1b16f15741b3">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>yJN6cXUwQxTmMEsPesBP2NkqYFI=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:param name="pNewType" select="'myNewType'"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Transform/@Algorithm[.='http://www.w3.org/TR/2001/REC-xml-c14n-20010315']">
<xsl:attribute name="Algorithm">
<xsl:value-of select="'http://www.w3.org/2001/10/xml-exc-c14n#'"/>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
能否请你让我知道什么是这个XSL的问题。
[在XSLT中使用名称空间前缀匹配元素]可能的重复(https://stackoverflow.com/questions/5100724/matching-elements-with-namespace-prefix-in-xslt) – Filburt
您能否让我知道。我们如何解决这个问题。 – user5458829
你*看过*链接的帖子和答案吗? – Filburt