xslt - msxsl:node-set() not recognized -
i trying pull nodes out of node set stored in variable using msxsl:node-set() function , not getting anything. xml looks this:
<root> <items olditemnumber="100" newitemnumber="200"> <item itemnumber="100" itemaliascode="1001" itemcode="x" /> <item itemnumber="100" itemaliascode="1002" itemcode="x" /> <item itemnumber="200" itemaliascode="2001" itemcode="x" /> <item itemnumber="200" itemaliascode="2003" itemcode="x" /> <item itemnumber="100" itemaliascode="1003" itemcode="p" /> <item itemnumber="100" itemaliascode="1004" itemcode="p" /> <item itemnumber="200" itemaliascode="2002" itemcode="p" /> </items> </root>
in xslt try populate variable subset of nodes , call them using msxsl:node-set() function. doesn't return however. xslt looks this:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:template match="//root"> <xsl:variable name="olditemnumber" select="/items/@olditemnumber"/> <xsl:variable name="newitemnumber" select="/items/@newitemnumber"/> <xsl:variable name="olditems"> <xsl:value-of select="//item[@itemnumber = $olditemnumber]"/> </xsl:variable> <xsl:variable name="newitems"> <xsl:value-of select="//item[@itemnumber = $newitemnumber]"/> </xsl:variable> <xsl:for-each select="msxsl:node-set($olditems)/item"> ...work </xsl:for-each> </xsl:template> </xsl:stylesheet>
the xslt skips on for-each loop, though see in watch the xpath query grabs right nodes in assigning variables. watch tells me msxsl:node-set() function undefined. appreciated. missing?
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:template match="//root"> <xsl:variable name="olditemnumber" select="/items/@olditemnumber"/> <xsl:variable name="newitemnumber" select="/items/@newitemnumber"/> <xsl:variable name="olditems" select="//item[@itemnumber = $olditemnumber]"/> <xsl:variable name="newitems" select="//item[@itemnumber = $newitemnumber]"/> <xsl:for-each select="$olditems"> ...work </xsl:for-each> </xsl:template> </xsl:stylesheet>
msxsl:node-set
converting result tree fragment (a.k.a. rtf) node set, not needed on case.
xsl:value-of
creating text nodes, don't use selecting nodes of input tree want further query/process.
Comments
Post a Comment