[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Adding a node to an existing node set
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|