Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to place an "xsl:value-of" into an inline string?

Tags:

xml

xslt

Ok here is an example what I'm trying to accomplish:

<div class="testClass1 {place xsl:value-of HERE}"> </div> Is there any way to pull something like this off in XML/XSLT?

Basically I just need to create an option to set the class for a wrapping div in XML... Not sure if this is possible.

like image 796
nthChild Avatar asked May 16 '11 18:05

nthChild


2 Answers

Use an Attribute-value-template:

<div class="testClass1 {xpath-expression}"> </div>

...or an xsl:attribute.

<div>
    <xsl:attribute name="class">testClass1 <xsl:value-of select="{xpath-expression}"/></xsl:attribute>
</div>
like image 67
Anders Lindahl Avatar answered Sep 19 '22 01:09

Anders Lindahl


You can always go with

<div>
   <xsl:attribute name="class">testClass1 <xsl:value-of select="..." /></xsl:attribute>
<div>
like image 24
phihag Avatar answered Sep 20 '22 01:09

phihag