Is there a way to put "xsl: value-of" in a string string?

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

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

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

+6
source share
2 answers

Use Attribute-value-template :

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

... or xsl: attribute .

 <div> <xsl:attribute name="class">testClass1 <xsl:value-of select="{xpath-expression}"/></xsl:attribute> </div> 
+12
source

You can always go with

 <div> <xsl:attribute name="class">testClass1 <xsl:value-of select="..." /></xsl:attribute> <div> 
+2
source

Source: https://habr.com/ru/post/888249/


All Articles