Here are three things that I thought would be equivalent but are not. Just
wondering why:
XmlElement foo = doc.CreateEleme nt("foo");
// load it up with a body
xslt.Transform (foo, null, new XmlTextWriter(n ew StringWriter()) );
xslt.Transform (foo.CreateNavi gator(), null, new XmlTextWriter(n ew
StringWriter()) );
xslt.Transform( new XmlNodeReader(f oo), new XmlTextWriter(n ew StringWriter()) );
Only the third one applies the transform and produces the expected output.
The first two produce nothing.
The docs say that passing in an XmlNode or navigator "usually an XmlDocument
or an XPathDocument"; it doesn't say the transform won't be applied *unless*
it's an XmlDocument.
I understand the XmlNodeReader is hiding the fact that it's starting at
something other than a document root.
I know this is an peculiar use case but was curious why the first 2 produced
nothing?
Thanks
Mark
wondering why:
XmlElement foo = doc.CreateEleme nt("foo");
// load it up with a body
xslt.Transform (foo, null, new XmlTextWriter(n ew StringWriter()) );
xslt.Transform (foo.CreateNavi gator(), null, new XmlTextWriter(n ew
StringWriter()) );
xslt.Transform( new XmlNodeReader(f oo), new XmlTextWriter(n ew StringWriter()) );
Only the third one applies the transform and produces the expected output.
The first two produce nothing.
The docs say that passing in an XmlNode or navigator "usually an XmlDocument
or an XPathDocument"; it doesn't say the transform won't be applied *unless*
it's an XmlDocument.
I understand the XmlNodeReader is hiding the fact that it's starting at
something other than a document root.
I know this is an peculiar use case but was curious why the first 2 produced
nothing?
Thanks
Mark
Comment