[XSLT] importer variable javascript
j'ai un souçi, je souhaiterai affecter la valeur d'une variable javascript à une variable XSL. (la transformation XML/XSL se fait coté client).
J'ai pu trouvé ce script sur google, mais ça ne fonctionne pas du tout.
Est ce que quelqu'un pourrait m'aider ?
Merci d'avance
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<script type="text/javascript"> <![CDATA[
var maVariable = "variable que je veux affecter";
]]></script>
<msxsl:script language="JavaScript" implements-prefix="js">
function getMaVariable() {
return maVariable;
}
function setMaVariable(newValue) {
maVariable = "newValue";
return ""; // grossiere astuce pour que "xsl:value-of" soit content...
}
</msxsl:script>
...
<xsl:value-of select="js:getMaVariable()"/>
...
</xsl:stylesheet> |
Il ne peut pas accéder à maVariable, il ne la connait pas.