[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Problem with passing a node to c# script from an xsl ...


Subject: [xsl] Problem with passing a node to c# script from an xsl ...
From: "Sai, Mukundan (IE10)" <Sai.Mukundan@xxxxxxxxxxxxx>
Date: Fri, 10 Jan 2003 03:26:32 -0700

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



Current Thread
Keywords