xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Adding a node to an existing node set


Subject: [xsl] Adding a node to an existing node set
From: Tom Zwick <sammy4352@xxxxxxxxx>
Date: Mon, 22 Jul 2002 14:44:10 -0700 (PDT)

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
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor