tags:

views:

52

answers:

1

Hi all. Please Help me out.

In C# i set a context value as

HttpContext.Current.Items["xmlcontentholder"] = xDoc.DocumentElement.FirstChild.OuterXml;

and

by processing XsltArgumentList i send it to an XSLT file:

XsltArgumentList XsltArgs = new XsltArgumentList();
XsltArgs.AddParam("xmlcontentholder", "", "xmlcontent");

and i m transforming it

xsltCompiledTrans.Transform(xPathNav, XsltArgs, stringWriter);

In XSLT file i gave as <xsl:value-of select="$xmlcontentholder" /><br/>12<xsl:value-of select="msxsl:node-set($xmlcontentholder)/ROW[1]/value" />34

My output is

<ROW><value>1</value><value>2</value></ROW>
1234

Please explain me on this problem..

+1  A: 

The problem: The OuterXml property is of type string, but in the XSLT transformation you are treating it as a node.

Solution: Pass to the transformation a node -- the C# parameter needs to be either an XPathNavigator (for a single node) or XPathNodeIterator for a node-set.

Therefore, use:

xDoc.DocumentElement.FirstChild.CreateNavigator()
Dimitre Novatchev
Thank You Dimitre Novatchev. Your ideas worked for me. you are awesome. I solved it.I also referred to the posthttp://stackoverflow.com/questions/2365295/merging-two-xpathdocuments-using-xmlcompiledtransformStackoverflow is superb.
Siva