[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Newbie question on XSL transformations: multiple

Subject: Re: Newbie question on XSL transformations: multiple sorts on element attributes
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Wed, 07 Feb 2007 00:01:23 +0100
Re:  Newbie question on XSL transformations: multiple
Rob Newman wrote:

I left some information out. I am actually importing data from 4 different XML files so I created a summary file (summary.xml) that consists of a parent element called 'sources' and child elements named 'source' that locally reference the URLs of all the XML files I need.

Then what is missing is the document(@href) function in your original code in the apply templates.


Almost! I have a whole series of pfarr elements. Each one has a pfstring element that has an id='dlt' and and value. Example:

<pfstring id='dlt'>20</pfstring>


This is quite different from your example input, where you showed one pfarr element with multiple pfstring children, each siblings to one another. I understand now, that instead of this:

   <pfarr name="dls">
       <pfarr name="abcde">
           <pfstring name="aa">0.010</pfstring>
           <pfstring name="br24">23266128.0</pfstring>
           <pfstring name="dlt">30</pfstring>

it is more like this:
   <pfarr name="dls">
       <pfarr name="abcde">
           <pfstring name="aa">0.010</pfstring>
       </pfarr>
       <pfarr name="ef">
           <pfstring name="br24">23266128.0</pfstring>
       </pfarr>
       <pfarr name="ghi">
           <pfstring name="dlt">30</pfstring>
....


with one additional change: all names are now always equal to 'dlt', right?


I want this to be output thus:

<datalogger name="B">
    <param id="dlt">80</param>
</datalogger>

<datalogger name="C">
    <param id="dlt">50</param>
</datalogger>


which, to me, looks quite different from your original output, where you kept the original siblings of params together.





To be verbose: I want to sort them so that the first datalogger element in the XML output is the one with the highest dlt. This is then followed by those with high dlt values. Once we get beyond the dlt values, the datalogger elements are ordered by their name. All dataloggers have a param element with an id of 'dlt' and an associated value.

Do you mean that siblings can occur, and that you want the pfarr that has highest available 'dlt' value to be output as first datalogger element? Or is there always only one dlt? What do you mean with "beyond dlt values"? It helps if you show the input as it really is, because it seems contradictory to say "Each one has a pfstring element that has an id='dlt' " and "Once we get beyond the dlt values", because they are always there.


Please clarify the following:

1. The order of the datalogger elements, based on some (cumulative?) value of their children
2. The order of the param elements inside each datalogger, if there are more than one (are there?)
3. Whether additional param elements influence the order of the datalogger, other then what you define by (1)
4. The exact content of your data (but keep it brief) and an example of the exact output, based on that very content. Make sure it clarifies the other points above, and the structure.



-- Abel


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.