Click to See Complete Forum and Search --> : XML to XML using a XSLT


CJensen
02-26-2010, 09:06 AM
I'm trying to perform a transform on a series of existing XML files to just get the records/pieces that I need. However, any way I do this just seems to result in the "text" only being displayed in say IE/Firefox as the result. It doesn't appear as though I'm really getting XML as a result.

An example I ran across on another website:
http://xmlfiles.com/articles/sample_chapters/sams_xmlforaspnet/default.asp (see 7.5-7.7)

When I replicate this tutorial, IE and Firefox both strip the resulting transformed file of any XML structure tags, and just display the text itself. Is there something I'm missing or misunderstanding in how to do an XML-XML transform?

Thanks

Webnerd
02-26-2010, 11:33 PM
CSS to display the XML as HTML. You need a browser side stylesheet. Using the web developer tools, "View Generated Source" in Firefox. By default XML has no styles.

CJensen
03-01-2010, 08:58 AM
CSS to display the XML as HTML. You need a browser side stylesheet. Using the web developer tools, "View Generated Source" in Firefox. By default XML has no styles.

Sorry, still don't think I'm understanding. If I take a XML file by itself and open it up in Firefox or IE, the structure of the XML is fully shown within the browser.

If I use an XSL transform to change the elements displayed, and add in the necessary tags before the 'xsl apply statements/select clause', and open the XML file again with the transform statement in place, I just get the text.

Are you saying I need to include a css page with the transform in order to get this done correctly?

Webnerd
03-04-2010, 07:21 AM
Yes, XML with XSL applied will show you nothing in the browser unless you have CSS applied. XML is not the same as HTML, there are no default styles unless your output type is HTML and has a DOCTYPE as such.