Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output result of xsl:value-of in an xml attribute

Tags:

xslt

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 outputting XML, the XSL processor won't allow me to write:

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

How do you accomplish this?

like image 705
Robert Höglund Avatar asked Sep 06 '25 13:09

Robert Höglund


1 Answers

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

<Output Attribute="{Some/Value}"/>
like image 126
Danko Durbić Avatar answered Sep 11 '25 06:09

Danko Durbić