I am having problems with XML. I am trying to transform one xml doc to another using xslt. I do this using notepad++ and IE to show the output. But I am facing a problem because I can't see the tags. I only get raw text and no xml when I transform it.
This is my xml code (example.xml):
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test.xsl"?> <root> <element> This is some text to test!!! </element> <element attr="someText"> This is some more text to test xml... </element> </root>
This is my stylesheet (test.xsl):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="root"> <xsl:for-each select="element"> <newElement> <xsl:value-of select="."/> </newElement> </xsl:for-each> </xsl:template> </xsl:stylesheet>
What I would like to see when I open example.xml in IE is:
<?xml version="1.0" encoding="UTF-8"?> <root> <newElement> This is some text to test!!! </newElement> <newElement attr="someText"> This is some more text to test xml... </newElement> </root>
But I only see this when I open example.xml in IE:
This is some text to test!!! This is some more text to test xml...
So I actually can't see the tags. What I would like to see is an xml tree. What am I doing wrong?
Another question I have: is it possible to save the new transformed xml document to another xml file?
I can only use xslt 1.0 and xpath 1.0.
No comments:
Post a Comment