Resolved XSLT

  • Thread starter Thread starter cameron
  • Start date Start date
C

cameron

When you create an XslTransform object, you do a load with the Starting
XML object and an XmlUrlResolver. The Idea is that it will resolve all
of the imports and includes. I would like to see what the resulting XML
looks like, (after it has been all resolved and stuff). I think I am
using the wrong objects because when I do:

string Filename = "Some Stylesheet.xsl";
XmlTextReader txtReader = new
XmlTextReader(HttpContext.Current.Server.MapPath(Filename));
XmlValidatingReader reader = new XmlValidatingReader(txtReader);
XmlUrlResolver resolver = new XmlUrlResolver();
reader.XmlResolver = resolver;

There is no way to see the OuterXML, (ReadOuterXml do not do what I
expected). I just want it to dump out the XML so I can take a look at
it. Just like when you do an XmlDocument.OuterXml. The XmlWriter doesn't
seem to have anything useful for this either. Any thoughts?

-Cam
 
Hi Cam

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you want to view the OuterXml from an
XmlTextReader. If there is any misunderstanding, please feel free to let me
know.

I have checked the code you have provided. We need to add a little more to
the code to read the outer xml. We have to call MoveToContent method to
move the current pointer to the node that has contents. Here I have add
some code.

string Filename = "Some Stylesheet.xsl";
XmlTextReader txtReader = new
XmlTextReader(HttpContext.Current.Server.MapPath(Filename));
XmlValidatingReader reader = new XmlValidatingReader(txtReader);
XmlUrlResolver resolver = new XmlUrlResolver();
reader.XmlResolver = resolver;

reader.MoveToFirstAttribute();
string s = reader.ReadOuterXml();

HTH. Does this answer your question? If anything is unclear, please feel
free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Cam,

Thank you for posting in the community!

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you want to view the OuterXml from an
XmlTextReader. If there is any misunderstanding, please feel free to let me
know.

I have checked the code you have provided. We need to add a little more to
the code to read the outer xml. We have to call MoveToContent method to
move the current pointer to the node that has contents. Here I have add
some code.

string Filename = "Some Stylesheet.xsl";
XmlTextReader txtReader = new
XmlTextReader(HttpContext.Current.Server.MapPath(Filename));
XmlValidatingReader reader = new XmlValidatingReader(txtReader);
XmlUrlResolver resolver = new XmlUrlResolver();
reader.XmlResolver = resolver;

reader.MoveToContent();
string s = reader.ReadOuterXml();

HTH. Does this answer your question? If anything is unclear, please feel
free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Cam,

I'd like to know if the issue has been resoved yet. Is there anything that
I can help on this? I'm still monitoring on it. If you have any further
questions about this issue, please reply to the post in newsgroup.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
I guess so. It didn't do what I expected.

I thought the XML from the included, (imports and includes), would
actually be combined into the 'resolved' xslt document. But it was not,
or at least not when it was displayed - assuming it all there in some
internal representation.

-Cam
 
Hi Cam,

I'm not quite sure about your meaning in your last post. Do you mean that
the XML document is not correctly resolved? If the XML document isn't
resolved properly, there might be something wrong with the XSL. Please try
to check if the XSL is correct according to the XML document.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top