Re: [xsl] suprised by <xsl:copy-of select="@*"/>

Subject: Re: [xsl] suprised by <xsl:copy-of select="@*"/>
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 06 Aug 2001 15:50:29 -0400
Hi Gerry,

At 03:08 PM 8/6/01, you wrote:
Why did I get
<td colspan="2" bgcolor="#CC0000">
instead of
<td>colspan="2" bgcolor="#CC0000"
?????

because when you said <xsl:copy-of select="@*"/> the processor recognizes you are copying attribute nodes, and attribute nodes can only exist on element nodes, so that's where it puts them. When serialized, the element node with its associated attribute nodes gets written <td colspan="2" bgcolor="#CC0000">.


Remember, it's nodes we're processing not strings!

The <xsl:attribute> instruction works the same way. Notice that it's an error in your stylesheet to say <xsl:attribute> or <xsl:copy-of select="@*"> (both of which create attribute nodes) *after* instructions to put child nodes of the element into the tree.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


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



Current Thread