This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]