XML document with root element named "root" and a child of root named "meta" is serialized as HTML when run through a transformation stripping namespaces
Added by Martin Honnen over 7 years ago
Over on StackOverflow someone was asking about stripping namespaces from an XML input document, when testing the stylesheet
to do this from the command line with Saxon 9.8.0.3 (EE as well as HE) I get a strange result for a document that has a root element named @root@ with a child element named @meta@, it seems Saxon serializes the result with method @html@.
Here is the input:
M
1976-07-19
ENG
This is a test.
the output I get is
M
1976-07-19
ENG
This is a test.
When I reduce the stylesheet to only say
I get the correct result (the @xml@ serialization):
M
1976-07-19
ENG
This is a test.
I haven't found anything in the XSLT 3.0 or XSLT 3.1 serialization specs explaining the @html@ serialization for the first stylesheet.
Replies (3)
Please register to reply
RE: XML document with root element named "root" and a child of root named "meta" is serialized as HTML when run through a transformation stripping namespaces - Added by Michael Kay over 7 years ago
Was it intentional to put < xsl:output method="html" /> in the stylesheet? That's always going to produce odd results if the document isn't actually HTML.
RE: XML document with root element named "root" and a child of root named "meta" is serialized as HTML when run through a transformation stripping namespaces - Added by Martin Honnen over 7 years ago
Sorry about that thread, I wrote the stylesheet in Netbeans instead of oXygen and somehow did not manage to notice that Netbeans had put @<xsl:output method="html"/>@ in there, even after wondering why I got the odd @html@ serialization. Of course that explains the problem.
RE: XML document with root element named "root" and a child of root named "meta" is serialized as HTML when run through a transformation stripping namespaces - Added by Michael Kay over 7 years ago
It's nice to know that even Martin Honnen makes mistakes!
Please register to reply