Hi,
I have managed to pass parameters to an xsl-element. The script is as followed:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:me="urn:my-scripts">
<msxsl:script language="javascript" implements-prefix="me">
<![CDATA[
function GetResult()
{
var szURL = window.location.href;
var szFileName = szURL.substring(szURL.lastIndexOf("/") + 1,szURL.indexOf(".xml") + 4);
var szSearch = window.location.search;
if (szSearch.indexOf("?") == 0) szSearch = szSearch.substring(1);
if (szSearch.length != 0)
{
var aRows = szSearch.split("&");
var aFields;
for (var i=0;i<aRows.length;i++)
{
aFields = aRows[i].split("=");
i=arows.length;
return aFieldsnt;
}
}
}
]]>
</msxsl:script>
<xslaram name="selection" select="me:GetResult()">
</xslaram>
<xsl:template match="Code_Penal">
<HTML>
<BODY>
<H2 align="center">
<FONT color="green">
Search results for "<xsl:value-of select="$selection"/>"
</FONT>
</H2>
<HR/>
<xsl:apply-templates select=".//Article[@Mots_cle]"/>
</BODY>
</HTML>
</xsl:template>
I added some extra code to the GetResult() function to get the parameters from the URL(only one now) and I got the next error:
Runtime-error Microsoft JScript 'window' is not defined line = 4, col = 4 (line is offset from the start of the script ...
What can I do to prevent this error?