OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XSL-question

[ Lists Home | Date Index | Thread Index ]
  • From: Marcus.Bernhardson@nokia.com
  • To: xml-dev@ic.ac.uk
  • Date: Thu, 18 Nov 1999 18:58:25 +0200

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@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)



  • Follow-Ups:



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS