I am using XSLT to build a quote builder, i need to be able to identify if an input has a 'greater than' value and struggling to get it working within an XSLT. I have tried using CDATA which doesn't seem to work and a bunch of other things!
I know it would be better to have a seperate js file however i need the js to use xslt variables as seen in example below.
can anyone help!?!?!
The below '==' needs to change to a '>' greater than like !> or >
if (totalHeight == 1100){
var ppm = <xsl:value-of select="$bLwPPM"/>;<!--lightweight cost up to 1100, will change to greater than in .js-->
}
else{
var ppm = <xsl:value-of select="$sLwPPM"/>;<!--lightweight cost up to 600-->
}
You should be able to use the disable-output-escaping attribute for this:
<xsl:text disable-output-escaping="yes"><![CDATA[
if (totalHeight > 1100) {
var ppm = ]]></xsl:text><xsl:value-of select="$bLwPPM" />;<!--lightweight cost up to 1100, will change to greater than in .js-->
<xsl:text disable-output-escaping="yes"><![CDATA[
} else {
var ppm = ]]></xsl:text><xsl:value-of select="$sLwPPM" />;<!--lightweight cost up to 600-->
}
Another way would be to only output the two variable values as global JS variables (that your external script could read), or if it makes sense - put them on some element as data-attributes?
Jquery within XSLT
Hi all,
I am using XSLT to build a quote builder, i need to be able to identify if an input has a 'greater than' value and struggling to get it working within an XSLT. I have tried using CDATA which doesn't seem to work and a bunch of other things!
I know it would be better to have a seperate js file however i need the js to use xslt variables as seen in example below.
can anyone help!?!?!
The below '==' needs to change to a '>' greater than like !> or >
Hi Peter,
You should be able to use the
disable-output-escaping
attribute for this:Another way would be to only output the two variable values as global JS variables (that your external script could read), or if it makes sense - put them on some element as data-attributes?
Hope that helps,
/Chriztian
is working on a reply...