how to concatenate (part of) variable to String in XSLT -
i see first couple of characters of variable 'vari' concatenated string abc=' here:
href="{concat('abc=', substring-before('vari', '='))}"
here whole snippet:
<xsl:template match="report:subelement"> <tr> <td> <message> <xsl:variable name="vari" select="."></xsl:variable> <xsl:copy-of select="." /> </message> </td> <td> <button type="button" onclick="window.location.href=this.getattribute('href')" href="{concat('abc=', substring-before('vari', '='))}" >kill thread</button> </td> </tr> </xsl:template>
that trivial question learning xslt.
you quite close, but: access value of variable have use dollar ($
) prefix. not put variable name in apostrophe.
therefore try:
href="{concat('abc=', substring-before($vari, '='))}
than throw error because variable declaration not in same context usage. variable declaration has in same element or in ancestor. put declaration @ top of subelement template or in <tr
element.
updated working template:
<xsl:template match=""report:subelement"> <xsl:variable name="vari" select="."></xsl:variable> <tr> <td> <message> <xsl:copy-of select="." /> </message> </td> <td> <button type="button" onclick="window.location.href=this.getattribute('href')" href="{concat('abc=', substring-before($vari, '='))}" >kill thread</button> </td> </tr> </xsl:template>
Comments
Post a Comment