Add an attribute with static value with xslt

后端 未结 1 929
走了就别回头了
走了就别回头了 2021-01-18 23:33

I need to add an attribute with a static value to all nodes of a specific type in an existing xml file using xslt. Basically something like this:



        
相关标签:
1条回答
  • 2021-01-19 00:10
    <xsl:template match="mynode">
     <xsl:copy>
      <xsl:attribute name="newatt">static string</xsl:attribute>
      <xsl:apply-templates select="node()|@*"/>
     </xsl:copy>
    </xsl:template>
    

    (or something like that) inserted into an XSLT that does an identity transform (see http://www.dpawson.co.uk/xsl/sect2/identity.html) should do the trick for you.

    0 讨论(0)
提交回复
热议问题