on 06-06-2006 7:26 PM
Hi there,
I've asked before about a XML to string XSLT mapping and the answers provided here helped me to successfully do that mapping! Thanks a lot!
I'm using the following mapping to convert a string back to XML.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://my.namespace.com">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:for-each select="//m:my_tag">
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But now, I'm having a problem converting back from string to XML. The response tag "m:mytag" has a string like this:
"<?xml version="1.0" encoding="UTF-8"?><tag1><tag2>Data</tag2></tag1>".
And when I use the XSLT mapping shown above, the output file comes like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<tag1>
<tag2>Data</tag2>
</tag1>
As you can see, the initial <?xml ...> tag is duplicated, and it generates a parsing error in XI.
How can I eliminate one of the "<?xml version="1.0" encoding="UTF-8"?>" strings in the mapping?
Thanks a lot.
hi,
try using:
<xsl:output method="html"/>
BTw
you can also try deleting the xml tag from your xslt
program but try html method too
Regards,
michal
Message was edited by: Michal Krawczyk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Wow!!!
The output="html" actually worked on XML Spy!
Removing the XSLT file initial tag didn't work.
I had already resolved this problem using the replace-string method that I found here: http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426
But your method is way more elegant and efficient. 🐵
I'll test the html method on XI, but I'm almost sure it'll work too.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.