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

Adding a node to an existing node set

Subject: Adding a node to an existing node set
From: Tom Zwick <sammy4352@xxxxxxxxx>
Date: Mon, 22 Jul 2002 14:44:10 -0700 (PDT)
tom zwick
Say the XPath expression ="/parent/child" returns all
children, how can I add a new child element and have
the resulting node set assigned to a variable.

I tried 
<xsl:variable name="newTree">
    <xsl:copy-of select="/parent/child"/>
    <child age="1">foo</child>
</xsl:variable>


However there seems to be a difference between
<xsl:variable name="newTree" select="/parent/child"/>

and 

<xsl:variable name="newTree">
    <xsl:copy-of select="/parent/child"/>
</xsl:variable>

Amont other things, the attributes seem to have
disappeared.
Can someone explain the difference between the two?

Also when I try 
<xsl:variable name="newTree">
    <xsl:for-each select="/parent/child">
       <xsl:copy-of select="."/>
    </xsl:for-each>
</xsl:variable>

Saxon complains saying : "Cannot write an attribute
when there is no open start tag"

Thanks,
Tom



__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.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.