<xsl:template name="ClickPIB">
<xsl:param name="abc" />
<xsl:param name="xyz" />
<xsl:if test="string-length($abc) > 0">
<script type="text/javascript">
$(document).ready(function () {
$('#<xsl:value-of select="concat($abc, '_td')"/>').getXYZ("<xsl:value-of select="concat(substring-before($abc,'_'), '_landreover_', substring-after($xyz,'PXN'))"/>");
});
</script>
</xsl:if>
</xsl:template>
The above works fine….
<xsl:template name="ClickPIB">
<xsl:param name="abc" />
<xsl:param name="xyz" />
<xsl:if test="string-length($abc) > 0">
<script type="text/javascript">
$(document).ready(function () {
$('#<xsl:value-of select="concat($abc, '_td')"/>').getXYZ("{concat($abc, 'blahblah')}", "<xsl:value-of select="concat(substring-before($abc,'_'), '_landreover_', substring-after($xyz,'PXN'))"/>");
});
</script>
</xsl:if>
</xsl:template>
The above doesn’t, the only thing I added was the “{concat($abc, ‘blahblah’)}” and this is the part that doesn’t get interpolated with the value.
WHY? OH WHY!?
Because attribute value templates (the expressions in curly brackets) do not get evaluated everywhere, but only in attributes (hence the name). Use:
just like you do in the other spots you want to write values to the output.
For increased code clarity, I’d recommend using variables: