Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

XSL/XML Transformation Question  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have the following in an XML file:
<DATA>
<FTPSITE server="ftp.siteA.com" directory="/usr/WebSphere">
<USER>
<USERNAME>kilgore</USERNAME>
<SIZE>5000</SIZE>
</USER>
<USER>
<USERNAME>lary</USERNAME>
<SIZE>3000</SIZE>
</USER>
<USER>
<USERNAME>Ming</USERNAME>
<SIZE>12000</SIZE>
</USER>
</FTPSITE>
<FTPSITE server="ftp.siteB.com" directory="/home/db2inst1">
<USER>
<USERNAME>kilgore</USERNAME>
<SIZE>10000</SIZE>
</USER>
<USER>
<USERNAME>harry johnson</USERNAME>
<SIZE>6000</SIZE>
</USER>
<USER>
<USERNAME>Ming</USERNAME>
<SIZE>22000</SIZE>
</USER>
</FTPSITE>
</DATA>
What I want to do using an XSL stylesheet is to output a table where every user is sorted by size. If a USERNAME occurs in different FTPSITEs, then add the SIZEs together.
So the results should be:
Ming 34000
kilgore 15000
harry johnson 6000
lary 3000
Any ideas?
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you can try this but it isnt tested.I still have problems with matching nodes so i dont know if this works

<xsl:for-each select="/DATA/FTPSITE">
<xsl:value-of select="USERNAME">
<xsl:sort order="descending" select="SIZE"/>
</xsl:for-each>
bye,
Holger
------------------

[This message has been edited by Holger Prause (edited January 19, 2001).]
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!