Subject: Re: [xsl] Newby Question reformatting xml From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx> Date: Mon, 17 Feb 2003 16:12:32 +0200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Newby Question reformatting x, Michael A. Thompson | Thread | RE: [xsl] Newby Question reformatti, Yates, Danny (ANTS) |
RE: [xsl] JD and Java Extension, Yates, Danny (ANTS) | Date | RE: [xsl] Newby Question reformatti, Yates, Danny (ANTS) |
Month |