Re: [xsl] Positions

Subject: Re: [xsl] Positions
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 11:19:55 +0000

>I have the following xsl:
> <xsl:for-each select="[full path]/literal">
>      <xsl:sort select="./@lang" data-type="text" order="ascending"/>
>Problem 1: I need the positions of "CUADRO" and "TABLEAU" to be reversed

You do not say on what basis this is to be done - I'm assuming that
the entry with lang="ES" to appear last.  If you want something
different the principle is the same: calculate a key for the sort
which does what you want.  For example (I didn't test this, apologies
for any typos):

Read that slowly!  What I am doing is making a key from a 't' or 'f'
followed by the @lang value.  So instead of just 'ES' or 'FR' you get
'tES' and 'fFR'.

If you have a hunt back in the archives you will find a discussion on
other ways to do this kind of thing - you may want to look for
Dimitri's generic sort for more complicated requirements (but keep it
simple if you can).

><xsl:if test="./@lang='EN'">
>                     <xsl:value-of
>         </xsl:if>
>I am trying to get the value of the preceding sibling, where name=number,
>again with no success - any suggestions?
I think you are just getting the syntax mixed up - '.' is not a
NodeTest.  Try

Trevor Nash

Traditional training & distance learning,
Consultancy by email

Melvaig Software Engineering Limited
voice:     +44 (0) 1445 771 271 
email:     tcn@xxxxxxxxxxxxx

 XSL-List info and archive:

Current Thread