Question

I'm fetching an URL address from XML file. That URL links to an HTML file, the html builds itself (using javascript) according to a parameter that I'm sending to him. One example line from the XML is:

<Module Id="1" URL="../../Modules/MessageComposer/module.htm" SRC="email.png" />

I would like to set this line to:

<Module Id="1" URL="../../Modules/MessageComposer/module.htm?UID=1" SRC="email.png" />

And I want to aks if this will work? Thanks in advance.

Was it helpful?

Solution

A local file won't query anything unless you use a local server to fetch your URLs.

So if you want a local file to react on parameters passed to it's URL, for example in HTML you can parse window.location.search with JavaScript and do something with it.

If you want to locally trigger a query, use a simple local server as LAMP/WAMP.


Get your parameters:

var params = window.location.search.slice(1).split("&");

With each get name and value:

for(var p=0; p<params.length; p++) {
  var nv = params[p].split("=");
  var name = nv[0], value = nv[1];
  // What you want to do with name and value...
}


Generating an HTML anchor with XSL:

<xsl:for-each select="//Module">
  <xsl:element name="a">
    <xsl:attribute name="href"><xsl:value-of select="URL"/></xsl:attribute>
    <xsl:value-of select="URL"/>
  </xsl:element name="a">
</xsl:for-each>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top