I have an tag, and need to assign value to it's attribute within my XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
I need to assign value to the trId attribute, but the way I have it now don't work, what is the right way to do it?
<ABX trId="<xsl:value-of select="CODE_VALUE"/>">
</xsl:template>
</xsl:stylesheet>
<ABX>
<xsl:attribute name="trId"><xsl:value-of select="CODE_VALUE"/></xsl:attribute>
</ABX>
The XSLT <attribute
> tag will do exactly what you want.
Or you could simply do this:
<ABX trId="{CODE_VALUE}"/>
The expression inside curly braces is evaluated and the result is put into the attribute value. See Section 7.6.2, Attribute Value Templates in the spec.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With