I am running into issues passing a parameter (that is a XML string) into a stylesheet and using msxsl:node-set to parse the string. Can someone please explain why.
my html:
var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0"); xsl.async = false; xsl.load("campaignHtml.xsl"); var template = new ActiveXObject("MSXML2.XSLTemplate"); template.stylesheet = xsl; processor = template.createProcessor; processor.input = xmlDocument; processor.addParameter( "conferenceDocument" ,xmlConferenceDocument.documentElement.xml); processor.transform;
my xsl:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.1"> <xsl
utput method="html" indent="yes"/>
<xsl
aram name="conferenceDocument" select="."/>
<!-- the function does not return anything when a parameter is used
-->
<xsl:value-of select=
"msxsl:node-set($conferenceDocument)/ROWSET/ROW/CONFERENCE_CODE" />
....
<!-- However when I print the parameter to screen and hardcode the screen output into a variable tag, the function works fine. -->
<xsl:variable name="conferenceDocument">
<ROWSET><ROW><CONFERENCE_ID>1</CONFERENCE_ID><CONFERENCE_CODE>SEC</CONFERENCE_CODE><CONFERENCE_NAME>Southeastern Conference</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>622</CONFERENCE_ID><CONFERENCE_CODE>NONE</CONFERENCE_CODE><CONFERENCE_NAME>Unassigned</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>111</CONFERENCE_ID><CONFERENCE_CODE>ACC</CONFERENCE_CODE><CONFERENCE_NAME>Atlantic Collegiate Conference</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>324</CONFERENCE_ID><CONFERENCE_CODE>B12</CONFERENCE_CODE><CONFERENCE_NAME>Big XII</CONFERENCE_NAME></ROW></ROWSET> </xsl:variable>
<xsl:value-of select=
"msxsl:node-set($conferenceDocument)/ROWSET/ROW/CONFERENCE_CODE" />
Can someone please explain why. Why is the parameter not being evaluated like the text written between the var tags above. Please enlighten me. I have spent 2 days on this.
Thanks,
Patrick
my html:
var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.3.0"); xsl.async = false; xsl.load("campaignHtml.xsl"); var template = new ActiveXObject("MSXML2.XSLTemplate"); template.stylesheet = xsl; processor = template.createProcessor; processor.input = xmlDocument; processor.addParameter( "conferenceDocument" ,xmlConferenceDocument.documentElement.xml); processor.transform;
my xsl:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" version="1.1"> <xsl
<xsl
<!-- the function does not return anything when a parameter is used
-->
<xsl:value-of select=
"msxsl:node-set($conferenceDocument)/ROWSET/ROW/CONFERENCE_CODE" />
....
<!-- However when I print the parameter to screen and hardcode the screen output into a variable tag, the function works fine. -->
<xsl:variable name="conferenceDocument">
<ROWSET><ROW><CONFERENCE_ID>1</CONFERENCE_ID><CONFERENCE_CODE>SEC</CONFERENCE_CODE><CONFERENCE_NAME>Southeastern Conference</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>622</CONFERENCE_ID><CONFERENCE_CODE>NONE</CONFERENCE_CODE><CONFERENCE_NAME>Unassigned</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>111</CONFERENCE_ID><CONFERENCE_CODE>ACC</CONFERENCE_CODE><CONFERENCE_NAME>Atlantic Collegiate Conference</CONFERENCE_NAME></ROW><ROW><CONFERENCE_ID>324</CONFERENCE_ID><CONFERENCE_CODE>B12</CONFERENCE_CODE><CONFERENCE_NAME>Big XII</CONFERENCE_NAME></ROW></ROWSET> </xsl:variable>
<xsl:value-of select=
"msxsl:node-set($conferenceDocument)/ROWSET/ROW/CONFERENCE_CODE" />
Can someone please explain why. Why is the parameter not being evaluated like the text written between the var tags above. Please enlighten me. I have spent 2 days on this.
Thanks,
Patrick