[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Problem with passing a node to c# script from an xsl .
Hi everybody ... I had earlier posted a question of how to pass node to a c# script . i got solution from people ... they told .. in the xslt pass it as <xsl:value-of select=" user:passNode( . ) )"/> where let us assume passNode is the c# script ... the xsl goes like this <xsl:template match="DataSources"> <xsl:for-each select="child::*"> <xsl:value-of select="user:GetPublishstring(current())"/> <xsl:text> : </xsl:text> </xsl:for-each> </xsl:template> <msxsl:script language="C#" implements-prefix="user"> <![CDATA[ XPathNavigator parentNode ; string mainString="" ; string GetPublishstring (XPathNodeIterator inputNode ) { XPathNavigator dataSourceNode = inputNode.Current ; mainString = String.Concat(mainString,",",dataSourceNode.Name,"\n"); return mainString ; } ]]> </msxsl:script> my xml is like this <?xml version="1.0"?> <DataSources> <DataSource Name="DS1"> </DataSource> <DataSource Name="DS2"> </DataSource> <DataSource Name="DS3" > </DataSource> <DataSource Name ="DS4"> </DataSource> </DataSources> the output is ,DataSource : ,DataSource ,DataSource : ,DataSource ,DataSource ,DataSource : ,DataSource ,DataSource ,DataSource ,DataSource the basic thing happening here even though i call the script once for every child the script is getting called once for every previous sibling .. i dont know how ... can anybody enlighten me on this generous behaviour of the script or the xslt ... eagerly awaiting the enlightement .. Mukund XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|