[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
reformatting xml
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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.