
Jens Tröger schrieb am 21.02.2015 um 20:21:
The following is based on this question here:
http://stackoverflow.com/questions/28398651/how-to-generate-markup-inside-of...
What I ended up using in my XSLT stylesheet was something along these lines:
<xsl:attribute name="bla"> <![CDATA[Here is <em>some</em>verbatim text with id="]]> <xsl:value-of select="@id"/> <![CDATA[" and <strong>more</strong> stuff.]]> </xsl:attribute>
This worked reliably. However, this worked only after a seemingly subtle fix to the text itself! Initially I had something like
id-<xsl:value-of select="@id"/>
i.e. there was some text before that <xsl:value>. This worked sometimes, but not others where suddenly the CDATA following that text/element combination was swallowed away. Removing any text around the <xsl:value> seems to work in all cases though.
I think this is better written as follows in XSLT: <tag bla="Here is <some> id={@id} ..." /> Stefan