|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Newby Question reformatting xml
-----Original Message----- From: "Michael A. Thompson" <mathomp@xxxxxxxxxxxxxx> Your problem is with the XPath expression "//DDD/@id". It selects the first node that matches this pattern, which, of course, is only correct for the children of the first <DDD> element. Use this expression instead: "parent::node()/attribute::id" or in abbreviated format: "../@id" While the latter is more concise, the former is easier to understand. Both expressions evaluate identically. If you are going for brevity, you could re-write the template so: <xsl:template match="BBB">
<xsl:element name="BBB">
<xsl:attribute name="num"><xsl:value-of select="../@id" /></xsl:attribute>
<xsl:value-of select="." />
</xsl:element>
</xsl:template>
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
|

Cart








