|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] strange behaviour in Xalan
Hello,
on another list there was a question about deleting the root-element. One
reply suggested
<xsl:template match="boxes">
<xsl:copy-of select="*|@*"/>
</xsl:template>
, which in my eyes can cause problems, if the root-element has attributes.
So I tested it with Xalan 2.2.D11. But I get a really strange output:
XML
<?xml version="1.0" encoding="UTF-8"?>
<boxes test="1">
<box id="1234">
<title>Ciao</title>
<body>This is the body of the box</body>
</box>
</boxes>
XSL
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="boxes">
<xsl:copy-of select="*|@*"/>
</xsl:template>
</xsl:stylesheet>
Output
<?xml version="1.0" encoding="UTF-8"?>
<box xmlns:xml="http://www.w3.org/XML/1998/namespace" test="1" id="1234">
<title>Ciao</title>
<body>This is the body of the box</body>
</box>
1. Why is the attribute test="1" not causing an error, but will be copied to
the new root-element?
2. Where does ' xmlns:xml="http://www.w3.org/XML/1998/namespace" ' come
from?
Changing the XSL to <xsl:copy-of select="*"/> the output is like expected.
In my eyes this is more than obviously a bug, but maybe I'm wrong. What can
you say about that?
Joerg
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








