Finally, I've found the solution. Here it is :
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<eurofxref>
<xsl:apply-templates/>
</eurofxref>
</xsl:template>
<xsl:template match="*[(_at_)*]">
<Row>
<time>
<xsl:value-of select="./@time"/>
</time>
<xsl:apply-templates select="*/@currency"/>
</Row>
</xsl:template>
<xsl:template match="@currency">
<xsl:variable name="Thename" select="."/>
<xsl:variable name="Therate" select="../@rate"/>
<xsl:element name="{$Thename}">
<xsl:value-of select="$Therate"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Result :
- <x>
- <row>
<time>2004-11-19</time>
<USD>1.302</USD>
<JPY>134.97</JPY>
</row>
- <row>
<time>2004-11-18</time>
..
Subject: RE: [xsl] Attribute to elements conversion, "preserving "and
simplifying hierarchy, insertion of new element
From: "Joe Heidenreich" <HeidenreichJ(_at_)xxxxxxxx>
Date: Fri, 19 Nov 2004 11:38:04 -0500
Do you want the <Row> to appear for each date?
Jeni has a great example on how to add hierarchy to a flat structure. You
can
view that here:
http://www.biglist.com/lists/xsl-list/archives/200012/msg00175.html
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--