aspose file tools
The moose likes XML and Related Technologies and the fly likes XSL/XML Transformation Question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "XSL/XML Transformation Question " Watch "XSL/XML Transformation Question " New topic
Author

XSL/XML Transformation Question

Darryl McCool
Greenhorn

Joined: Jan 03, 2001
Posts: 8
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?
Holger Prause
Ranch Hand

Joined: Oct 09, 2000
Posts: 47
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).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XSL/XML Transformation Question
 
Similar Threads
date range in xsl
How to upload files in Java
Deploying DS using MBeanServer and MainDeployer on the fly
Excel Treating String as Date
Problem with xml file