Subject: Re: [xsl] Positions From: Trevor Nash <tcn@xxxxxxxxxxxxx> Date: Tue, 13 Nov 2001 11:19:55 +0000 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Positions, Tanzila Mohammad | Thread | [xsl] JSP serializer?, Annalisa Ricci |
RE: [xsl] Positions, Tanzila Mohammad | Date | [xsl] Getting several instances to , Paul Terray |
Month |