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

XSL-question

  • From: Marcus.Bernhardson@n...
  • To: xml-dev@i...
  • Date: Thu, 18 Nov 1999 18:58:25 +0200

order by xsl for each
Hello there!

Im new to this list (and pretty new to XML/XSL...) and i hope that its ok to
ask a question about XSL here. Please tell me if Im at the wrong place.
I have a very anoying problem i cant solve using XSL with IE5.

I have a xml-file and i wanna list the info in it and sort/filter it
depending on how you select. I use javascript in a html file for selecting
sorting/filtering.

I wanna be able to use a global variable or function to use with the
"select" and "order-by" statements. It doesnt seem to work though.


my XML-file looks something like this:

<root>
 <element>
 	<childelement1/>
	<childelement2/>
	<childelement3/>
 </element>
 
 <element>
 	<childelement1/>
	<childelement2/>
	<childelement3/>
 </element>

 etc...

</root>


I wanna sort all elements in a table so my XSL-file looks something like
this:

<table>
 <xsl:for-each select="root/element" order-by="+childelement2">
  <tr>
   <td>
    <xsl:value-of select="childelement1"/>
   </td>
   <td>
    <xsl:value-of select="childelement2"/>
   </td>
   <td>
    <xsl:value-of select="childelement3"/>
   </td>
 </tr>
 </xsl:for-each>
</table>

When I sort with order-by I wanna use a variable or a function that returns
the sortingcriteria. I cant get it to work, is it possible?

What I mean is that I wanna do something like this:

* with a variable called selectedSort that contains the string
'childelement1', 'childelement2' or 'childelement3':
<xsl:for-each select="root/element" order-by="+selectedSort">
or
* with a function that returns the string 'childelement1', 'childelement2'
or 'childelement3':
<xsl:for-each select="root/element" order-by="+selectedSort()">

If this would work then i could use 1 XSL-file instead of 1 for every
sorting/filtering combination (would be many....). 


When i filter i do like this:
 <xsl:for-each select="root/element[childelement= 'criteria1']"
order-by="+childelement1">

I have same problem here. I wanna be able to do something like this:

<xsl:for-each select="root/element[childelement1= selectedCriteria]"
order-by="+childelement1">
or
<xsl:for-each select="root/element[childelement1= selectedCriteria()]"
order-by="+childelement1">


I would be forever thankful if there a nice person out there who could help
me solving this. Or atleast tell me if its possible while using IE5.

Thanks/
Marcus


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.