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

Re: Positions

Subject: Re: Positions
From: Trevor Nash <tcn@xxxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 11:19:55 +0000
dimitri s generic sort
Tanz,

>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):
<xsl:sort
   select="concat(substring(@lang='ES',1,1),@lang)"
   data-type="text"
   order="ascending"/>

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
>select="preceding-sibling::.[@name='number']"/>
>         </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
preceding-sibling::literal[@name='number']

Regards,
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:  http://www.mulberrytech.com/xsl/xsl-list


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.