C# transform and xml nodes

P

Praveen

Doing an xslt transform in C#.
Adding an object as below before transform.

ARG.AddExtensionObject("urn:MyCompany-Generic",Generic);

'Generic' is an instance of a class which contains various functions which
can be acceced in xsl by namespace.
Like <xsl:value-of select="namespace:MyFunction()"/>

looking for a function which returns nodes from an xml string which can be
looped inside xsl for retrieving attribute values.

Transforming xml wil be like
'<R><A>&lt;R&gt;&lt;E V=&quot;1&quot;/&gt;&lt;E
V=&quot;2&quot;/&gt;&lt;/R&gt;</A></R>'

Here <A> contains another xml. I want to add a name space function to load
the xml and return nodes.

Hopes its clear.
thanks,
praveen
 
P

Praveen

Praveen said:
Doing an xslt transform in C#.
Adding an object as below before transform.

ARG.AddExtensionObject("urn:MyCompany-Generic",Generic);

'Generic' is an instance of a class which contains various functions which
can be acceced in xsl by namespace.
Like <xsl:value-of select="namespace:MyFunction()"/>

looking for a function which returns nodes from an xml string which can
be looped inside xsl for retrieving attribute values.

Transforming xml wil be like
'<R><A>&lt;R&gt;&lt;E V=&quot;1&quot;/&gt;&lt;E
V=&quot;2&quot;/&gt;&lt;/R&gt;</A></R>'

Here <A> contains another xml. I want to add a name space function to load
the xml and return nodes.

Hopes its clear.
thanks,
praveen

I got he solution.
For ref:

public XPathNodeIterator GetNodes(string xml,string xpath)

{

XmlDocument ToSndrXmlObj = new XmlDocument();
ToSndrXmlObj.LoadXml(xml);
XPathNavigator NavEmail = ToSndrXmlObj.CreateNavigator();
return ToSndrXmlObj.CreateNavigator().Select(xpath);

}

praveen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top