xsl-list
[Top] [All Lists]

[xsl] Get Variables in XSL from URL

2006-04-28 12:54:20
Hello,
I would like to get some variables from the URL 
(file.xml?var1=value1&var2=value2) in the test.xml's xsl file (all of this in 
the client-side) and so have try this code:
<msxsl:script language="javascript" implements-prefix="prefix">
function getURLvar(name){
  var params = location.search.substring(1).split("&");
  var variables = new Array();
    for (i in params) {
      var segments_var = params[i].split("=");
      variables[segments_var[0]] = unescape(segments_var[1]);
    }
  function setFile(file) {
    iSend = send;
  }
return variables[name];
}
</msxsl:script>

and use this one to print on screen the value of the GET variables....

  <xsl:value-of select="prefix:getURLvar(test)" />

But it seems not to be a good Method... and i ask if their is a better solution 
to achieve my goal.

Thanks, and sorry for my bad english.

Maxime G.


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>