Subject: Re: Questions on the new XSL spec (section 2.7.12) From: James Clark <jjc@xxxxxxxxxx> Date: Tue, 29 Dec 1998 13:01:48 +0700 |
Steve Dahl wrote: > > In Section 2.7.12, the definition seems pretty clear, but I just wanted > to confirm that <xsl:copy>, when applied to an attribute node, can only > copy the attribute, and cannot modify its value. Right. > Also, is there any difference between <xsl:element name="{name(.)}"> and > <xsl:copy>, when the current node is an element? <xsl:copy> talks about > copying the namespace nodes of the element--if you wanted to exactly > copy an element using <xsl:element>, how would you read the namespace > nodes of a source element, and how would you create namespace nodes in > the destination element? There's no way to do this currently. To handle this, you would need a pattern that matched namespace nodes, and an element that created namespace nodes, so you could do something like: <xsl:element name="{name(.)}"> <xsl:for-each select="namespace()"> <xsl:namespace name="{name(.)}"> <xsl:value-of select="."/> </xsl:namespace> </xsl:for-each> </xsl:element> > It sounds like the destination namespace nodes > could be created using something like: > > <xsl:attribute name="xmlns:prefix"><xsl:value-of > select="???"/></xsl:attribute> > > ...but because namespace-declaring attributes are not available in the > source tree, how can we know what the original namespace URI was? Or the > original prefix? Given markup of the form <foo xmlns:bar="some uri"/> you get a foo element node with no attribute nodes and a namespace node with name "bar" and value "some uri". xsl:attribute creates attribute nodes not namespace nodes so it won't help you. James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Questions on the new XSL spec (sect, Steve Dahl | Thread | Re: Questions on the new XSL spec (, G. Ken Holman |
Re: Questions on the new XSL spec (, James Clark | Date | XSL processor in Java for xml and x, Zvi Schreiber |
Month |