[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Re: Newby Question reformatting xml
Subject: Re: Newby Question reformatting xml
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Mon, 17 Feb 2003 16:12:32 +0200
|
Michael A. Thompson wrote:
My XSL file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="AAA">
<xsl:element name="AAA">
<xsl:apply-templates select="DDD" />
</xsl:element>
</xsl:template>
<xsl:template match="DDD">
<xsl:element name="DDD">
<xsl:apply-templates select="BBB"></xsl:apply-templates>
</xsl:element>
</xsl:template>
<xsl:template match="BBB">
<xsl:element name="BBB">
<xsl:attribute name="num">
<xsl:value-of select="//DDD/@id"></xsl:value-of>
</xsl:attribute>
<xsl:value-of select="."></xsl:value-of>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Try simple one:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="AAA">
<AAA>
<xsl:apply-templates select="DDD"/>
</AAA>
</xsl:template>
<xsl:template match="DDD">
<DDD>
<xsl:apply-templates select="BBB"/>
</DDD>
</xsl:template>
<xsl:template match="BBB">
<BBB num="{ancestor::DDD[1]/@id}">
<xsl:value-of select="."/>
</BBB>
</xsl:template>
</xsl:stylesheet>
--
Oleg Tkachenko
Multiconn Technologies, Israel
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
RSS 2.0 |
|
Atom 0.3 |
|
|