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..
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()
精彩评论