xsl-list
[Top] [All Lists]

RE: Attribute to elements conversion, "preserving "and simplifying hierarchy, insertion of new element

2004-11-22 01:46:56
Yes. Han (thank you) provided the following solution, which inserts a <row>
after each time/currency combination but it is not exactly the end result
I'd like to reach :
 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method='xml'
indent='no' omit-xml-declaration='yes'/>

<xsl:template match='/'>
<x>
<xsl:apply-templates select='//Cube[not(*)]'/>
</x>
</xsl:template>

<xsl:template match='Cube'>
<row>
<time><xsl:value-of select="../@time"/></time>
<xsl:element name="{(_at_)currency}"><xsl:value-of 
select="@rate"/></xsl:element>
</row>
</xsl:template>

</xsl:stylesheet>

Result :

- <x>
- <row>
  <time>2004-11-19</time>
  <USD>1.302</USD>
  </row>
- <row>
  <time>2004-11-19</time>
  <JPY>134.97</JPY>
  </row>
- <row>

The end result would be something like : 
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/ .



--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>