all groups > dotnet xml > march 2005 >
You're in the

dotnet xml

group:

passing a nodeset into an xslt file.


passing a nodeset into an xslt file. amit L via DotNetMonster.com
3/27/2005 3:51:47 PM
dotnet xml: hi all.

i've been trying to pass a nodelist (!=nodeset??) from my c# application to
some xsl transform to use.

the xsl code is as follows:
<xsl:stylesheet version="1.0" exclude-result-prefixes="extern msxsl local
xql" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:local="#local-functions"
xmlns:xql="#xql-functions" xmlns:extern="urn:dottraffic:lnk">
<xsl:template match="/">
<span>1
<xsl:variable name="rrr" select="extern:GetRss(1, 'amit')//item"/>
c:<xsl:value-of select="count($rrr)" /><br/>
</span>
</xsl:template>
</xsl:stylesheet>

the c# code is:


public XmlNodeList GetRss(long RssID, string Argument)
{
XmlDocument oDoc = new XmlDocument();
//oDoc.LoadXml(oRemote.Get(sTemplate, false));
oDoc.LoadXml("<root><item><title>amittitle</title></item></root>");
return oDoc.SelectNodes("//item");
}

when i debug and stop at the last line of the GetRss function i can see
that the SelectNodes functions does return one node. but the transform will
not go into the for-each.

any ideas anyone?

--
Re: passing a nodeset into an xslt file. Oleg Tkachenko
3/27/2005 9:15:52 PM
[quoted text, click to view]

In .NET nodeset is represented by XPathNodeIterator class.

--
Oleg Tkachenko [XML MVP, MCP]
Re: passing a nodeset into an xslt file. amit L via DotNetMonster.com
3/28/2005 5:03:53 PM
Thanks a lot Oleg. I will try it.

--
AddThis Social Bookmark Button