[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: strange behaviour in Xalan

Subject: Re: strange behaviour in Xalan
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 20 Oct 2001 07:12:52 -0700 (PDT)
xalan ignores xsl output indent
> <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?

Because your XSLT processor is buggy. An attribute node will be copied into the
current output destination only in case there is a still open element (copied)
there.

This is exactly the same as for xsl:attribute or xsl:copy.

In this specific case an XSLT processor must either signal the error (Saxon) or
ignore it silently (MSXML3). Copying an attribute to another element node is a bug.

> 2. Where does ' xmlns:xml="http://www.w3.org/XML/1998/namespace"; ' come
> from?

Every element node in a well-formed xml document has the "xml" namespace node.
However, it is "default" and need not be explicitly declared. Outputting it as a
namespace declaration may be considered as a bugette.


Cheers,
Dimitre Novatchev.

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.