I would like to know if it's possible to include an "external" variable (javascript in my case) in a xsl condition.
In my example, I get a coordinate on a map with some javascript, my xMax var. And I would like to use this xMax var in a "xsl:if" to find all the 'entries' for which the latitude is inferior or equal to xMax.
An excerpt of my script :
var cpt = 0;
var xMax = map.getBounds().getNorthEast().lat();
<xsl:for-each select="entries/entry">
<xsl:if test="latitude <= xMax">
cpt++;
</xsl:if>
</xsl:for-each>
alert(cpt);
I found the "msxsl:script" element, and i tried this :
<msxsl:script language="JScript" implements-prefix="user">
function getXMax(){
var xMax = map.getBounds().getNorthEast().lat();
return xMax;
}
</msxsl:script>
and called it with :
<xsl:value-of select='user:getXMax(.)'/>
But it doesnt seems to work. (I have also included
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://localhost:8080/Projet/map"
in the xsl:stylesheet)
If someone know how to pass my js var into the condition or how to parse a js var to a xslt var, thank for any help !