[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] problem adding a new element to an XML document using xsl:element...


Subject: Re: [xsl] problem adding a new element to an XML document using xsl:element...
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 23 Sep 2004 16:02:20 +0100

> I notice I still have to include the <ROWSET> and </ROWSET> literals in 
> the stylesheet.

I tend to do that but you can replace ROWSET by xsl:copy if you prefer
Your template for ROWSET basically should look like the template for the
identity transform, with the one extra bit that you want to add, namely
the TABLE element. In teh identity transform as you are matching * you
have to use xsl:copy as you don't know the element name, but when
matching an explict element it's a matter of taste which to use.

> the current solution implies that I would have to manually 
> recontruct any attributes the ROWSET element might have in the input XML?

No, just add
<xsl:copy-of select="@*"/>
and it'll copy all the attributes over, again this should also be in
your identity transform (the one in the xslt spec applys templates to @*
rather than copying them but it's the same thing as the templates
matching attribute nodes then copy the nodes)


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords