|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Attribute to elements conversion, preserving and
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="*[@*]">
<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: Attribute to elements conversion, "preserving "and
simplifying hierarchy, insertion of new element
From: "Joe Heidenreich" <HeidenreichJ@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/ .
|
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
|

Cart








