& XSLT Hi all,
I would like to use a returned value from JavaScript function in order
to input to a call-template. The compiler can not understand the
JavaScript function. I knew that I was missing something in my codes but
I could not figure out. Please help me to fix my code. Thanks in
advanced. Cathy
The following is my sample:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output version="1.0" encoding="utf-8" omit-xml-declaration="yes"
indent="no" media-type="text/html" />
<xsl:template match="/">
<HTML>
<HEAD>
<script type="text/javascript">
function getInstance(string)
{
instance =
string.substr(string.lastIndexOf(" "));
return instance
}
</script>
</HEAD>
<BODY>
<TABLE border="1" bgColor="#FFFFCC">
<TH> Group</TH><TH>Name</TH><TH>Value</TH><TH>Units</TH>
<xsl:for-each
select="//ReportObject[@mmId='381911A60306']">
<TR>
<xsl:variable
name="descriptiveName" select="ObjectInfo/DescriptiveName" />
<script type="text/javascript">
<xsl:variable
name="instanceId" select="getInstance('$descriptiveName')" />
</script>
<xsl:call-template
name="ID38186530022D" >
<xsl:with-param
name="curInstance" select="$instanceId" />
</xsl:call-template>
</TR>
</xsl:for-each>
</TABLE>
</BODY>
</HTML>
</xsl:template>
<xsl:template name="ID38186530022D" >
<xsl:param name="curInstance" />
<xsl:for-each
select="../ReportObject[@mmId='38186530022D']/PropertyData/Vector[Value[
1] = $curInstance]" >
<TD> <xsl:value-of select="$curInstance" /></TD>
<TD> <xsl:value-of select="Value[2]" /></TD>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>