XSL-question

G. Ken Holman gkholman at CraneSoftwrights.com
Thu Nov 18 17:31:42 GMT 1999


At 99/11/18 18:58 +0200, Marcus.Bernhardson at nokia.com wrote:
>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.

A better place is:

  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

>I have a very anoying problem i cant solve using XSL with IE5.
>...
>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?

Such a criterion is available using W3C XSLT, not IE5 XSL ... with W3C XSLT 
you can specify a sort key based on a function.

>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">

Oh.  I'm not really sure what you are asking for, then.

>* 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....).

Have you examined using general entities (but may not work in IE5) to 
parameterize the encoding of attributes and sub-elements?

>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">

Same answer from me ... such parameterization as I *think* you've described 
isn't possible in XSLT.  But, I think if you were to parameterize the 
*stylesheet markup* instead of trying to parameterize *stylesheet 
behaviour*, you will get what you are looking for.

Also, I expect you want to do "//element[..." to choose from all elements 
with the given predicate (which is not quite what you are asking for).

I hope this helps.

................... Ken

--
G. Ken Holman                    mailto:gkholman at CraneSoftwrights.com
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-02-0
Next instructor-led training:              1999-12-05/06, 1999-12-07,
-                            2000-02-27/28, 2000-05-11/12, 2000-05-15


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at 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 at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list