tags:

views:

467

answers:

2

I have an XML input file and I'm trying to output the result of a call like:

<xsl:value-of select="Some/Value"/>

into an attribute.

<Output Attribute="Value should be put here"/>

My problem is since I'm outputing XML the xsl processor won't allow me to write:

<Output Attribute="<xsl:value-of select="Some/Value"/>">

How do you accomplish this?

+6  A: 

You need to use an xsl:attribute element:

<Output>
  <xsl:attribute name="Attribute">
    <xsl:value-of select="Some/Value"/>
  </xsl:attribute>
</Output>
Phil Ross
+8  A: 

The easiest way is to use attribute value templates, like this:

<Output Attribute="{Some/Value}"/>
Danko Durbić