Subject: RE: [xsl] IF-ELSE.. Sorting From: Rene de Vries <RdVries@xxxxxxxxxxx> Date: Mon, 18 Jun 2001 14:26:55 +0200 |
Hi Karlo, As you may already have read in your XSLT-book: there is no IF-ELSE-construction, just use: <xsl:choose> <xsl:when test="..."> ... </xsl:when> <xsl:otherwise> ... </xsl:otherwise> </xsl:choose> furtermore the message "Keyword xsl:sort may not be used here. " you get is because <xsl:sort...> must be the first element (child) within <xsl:for-each...> and <xsl:apply-templates....>. And that gives you a new problem, because an <xsl:choose> is not allowed before the <xsl:sort...> I think you have to fill a parameter and pass it to a template which will do the for-each and the sort. Greetings Rene { @ @ } ^ \__/ "You don't need eyes to see, you need vision!" -----Oorspronkelijk bericht----- Van: pcaspian@xxxxxxxxxxx [SMTP:pcaspian@xxxxxxxxxxx] Verzonden: maandag 18 juni 2001 13:16 Aan: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Onderwerp: [xsl] IF-ELSE.. Sorting <xsl:for-each select="LIST/ASSIGN"> * Hi, I am trying to do a conditional sort. I want to have a look at an input parameter $arrangeby and if this is of Type DATE then I would like to specify a sorting different from my usual <xsl:sort select="*[name()=$arrangeby]"/> as now I want to specify the data-type as "number" and then also break it up into substring-before and substring-after, I will want to specify a different <xsl:sort>, so I assumed I would use <xsl:if test="$arrangeby = 'DATE'"> and put in my xsl code and finish it off with </xsl:if>. To start off with, quite basically, I need to know precisely how the if-else syntax works. Hehhe, just cant find an If-Else example. Secondly if I use this basic IF check... <xsl:for-each select="LIST/ASSIGN"> <xsl:if test="$arrangeby = 'TSDATE'"> <xsl:message> Hello </xsl:message> </xsl:if> <xsl:sort select="*[name()=$arrangeby]"/> I get the error "Keyword xsl:sort may not be used here. " The <xsl:if>..</xsl:if> block works fine when place just before the <xsl:for-each> block. **finally got my XSLT book, so hopefully I will ask less daft questions in the future. Thanks for all those that have managed to just "grin and bare" my simple questions so far ;) Karlo XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Re: [xsl] IF-ELSE.. Sorting, Dimitre Novatchev | Thread | RE: [xsl] IF-ELSE.. Sorting, Michael Kay |
Re: [xsl] String manipulation in XS, cutlass | Date | RE: [xsl] How to get the previous n, Sri ni |
Month |