• Advertisement
Sign in to follow this  

(XSLT) Using node-set() with string output from a script

This topic is 4353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

G'day, The aim of what I am doing is to sort through the XML, select the nodes I need and then output them. Currently, I am trying to iterate over the output from a script and display it using XSLT. Although the code below isn't doing anything complex at all, it's is to see how I would nodes from a script to the XSLT. I need the nodes returned from a script because I plan on doing a more complex selection process than XSLT offers. I have the following XSLT as a test script (the XML isn't required because I don't really use it, the main focus is on the msxml:script and the node-set() calls. I'm just trying to get this functionality working):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
	exclude-result-prefixes="msxsl var user">
	<xsl:template match="//stage">


<xsl:element name="p"> Test: <xsl:value-of select="user:test()" /> </xsl:element> <xsl:variable name="test_vardn"> <xsl:copy-of select="user:test()" /> </xsl:variable> Starting output: <xsl:element name="hr" /> <xsl:for-each select="msxsl:node-set($test_vardn)/deliverableinfo" >

<xsl:value-of select="@name" />

</xsl:for-each> <xsl:element name="hr" /> </body> </html> </xsl:template> <msxsl:script language="C#" implements-prefix="user"><![CDATA[ string test() { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.AppendChild( xmlDoc.CreateElement( "root" ) ); XmlElement xmlElement = xmlDoc.CreateElement( "deliverableinfo" ); xmlElement.InnerText = "Figaro."; xmlDoc.DocumentElement.AppendChild( xmlElement ); return "<deliverableinfo name=\"tt\">Mwhuahauha</deliverableinfo><deliverableinfo name=\"_t_\">meow</deliverableinfo>"; //xmlDoc.DocumentElement.InnerXml; } string anothertest() { return "Mwhuahauhauuahua."; } ]]></msxsl:script> </xsl:stylesheet>
Thanks in advance!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement