Hello,
I've been trying to convert the following XML structure
(http://www.ecb.int/stats/eurofxref/eurofxref-hist.xml) to achieve
something like this :
<?xml version="1.0" encoding="UTF-8" ?>
<EuroFxRef>
<Row>
<time>2004-11-19</time>
<USD>1.302</USD>
....
</Row>
<time>2004-11-18</time>
<USD>1.3024</USD>
....
</EuroFxRef>
After checking the list and FAQ for similar problems (attribute to element
conversion, hierarchy, ...), I came up with the following XSL which is
close to what I'm trying to get but not quite it as I do not see how to
insert the <Row> element as shown here above:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml"/>
<xsl:template match="/">
<EuroFxRef>
<xsl:apply-templates select="*|@*"/>
</EuroFxRef>
</xsl:template>
<xsl:template match="*">
<xsl:apply-templates select="*|@*"/>
</xsl:template>
<xsl:template match="@time">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</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:template match="@rate"/>
</xsl:stylesheet>
Thanks in advance,
João
--------------------------------------------------------------------
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>
--~--