[xsl] Re: RE: strange behaviour in Xalan

Subject: [xsl] Re: RE: strange behaviour in Xalan
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 20 Oct 2001 08:19:52 -0700 (PDT)
> > <xsl:template match="boxes">
> >     <xsl:copy-of select="*|@*"/>
> > </xsl:template>
> >
> > , which in my eyes can cause problems, if the root-element
> > has attributes.
> 
> I don't understand why you should think this can cause problems.

This definitely causes a problem, as there isn't an open (for which no children have
been copied yet) element node being created in the output, to which this attribute
node should belong.

> 
> > 1. Why is the attribute test="1" not causing an error, but
> > will be copied to the new root-element?
> 
> You asked for it to be copied by specifying <copy-of select="@*"/>

>From the XSLT 1.0 Spec:

"The following are all errors:

Adding an attribute to an element after children have been added to it;
implementations may either signal the error or ignore the attribute.

Adding an attribute to a node that is not an element; implementations may either
signal the error or ignore the attribute.

Creating nodes other than text nodes during the instantiation of the content of the
xsl:attribute element; implementations may either signal the error or ignore the
offending nodes."


This concrete case is exactly what the first bullet above describes.

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