Hi,
I write a javascript function in xsl (UOMConversion. xsl) as follow:
I would like to import above UOMConversion.x sl into a xsl (LibUserFunctio ns.xsl). I write:
I got an error when I use LibUserFunction s.xsl to transform an xml - "Keyword xsl:stylesheet may not contain script. Error occurred during compilation of included or imported stylesheet 'file..."
Where is the problem?
Regards
maxin
I write a javascript function in xsl (UOMConversion. xsl) as follow:
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<script language="Javascript">
<![CDATA[
var ISOUOM= new Array("KGM","MTR","LTR","CT");
var MESUOM= new Array("KG","M","L","KAR");
function UOMISOTOMES(UOMIn) {
var i;
var UOMOut;
for (i=0; i<=ISOUOM.length; i++)
{
if (UOMIn == ISOUOM[i]) {
UOMOut = MESUOM[i];
}
}
return UOMOut;
}
]]>
</script>
</xsl:stylesheet>
Code:
<xsl:stylesheet version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="UOMConversion.xsl"/>
....
</xsl:stylesheet>
Where is the problem?
Regards
maxin
Comment