Re: [xsl] using parameters in filters?

Subject: Re: [xsl] using parameters in filters?
From: "Mattias Konradsson" <preacher@xxxxxxxxxxx>
Date: Sat, 24 Feb 2001 12:51:36 +0100
> What you want is 9probably) something more like
>   <xsl:apply-templates select="message[@repliedto = $filter]" />
>
> together with
>   xslProc.addParameter("filter", "False");

argh! there's got to be a better way, this forces me to use this kind of
bungled code, and I can't even use params in sort elements since they can't
be contained in a if clause

<snip>

<xsl:template match="NewDataSet">
  <table border="0" cellspacing="0" cellpadding="0"  width="100%"
bgcolor="">

   <tr bgcolor="#eaeaea">
    <td width="100" onclick="sortMessages('sender')"><div
class="topbutton">Från</div></td>
    <td width="140" onclick="sortMessages('subject')"><div
class="topbutton">Ämne</div></td>
    <td onclick="sortMessages('date ')"><div class="topbutton"
>Skickat</div></td>
   </tr>
  </table>
  <table border="0" cellspacing="0" cellpadding="3"  width="100%"
bgcolor="">

 <tr bgcolor="silver">
 </tr>

  <xsl:choose>
   <xsl:when test="$filterField ='repliedto'">
      <xsl:for-each select="header[RepliedTo = $filterValue]">
       <xsl:sort select="$sortby" order="ascending"/>
       <xsl:apply-templates select="." />
      </xsl:for-each>
   </xsl:when>
   <xsl:when test="$filterField ='dateread'">
      <xsl:for-each select="header[not(DateRead)]">
       <xsl:apply-templates select="." />
      </xsl:for-each>
   </xsl:when>

   <xsl:when test="$filterField ='all'">
      <xsl:for-each select="header">
        <xsl:sort select="$sortby" order="ascending"/>


       <xsl:apply-templates select="." />
      </xsl:for-each>
   </xsl:when>

  </xsl:choose>


  </table>
 </xsl:template>

</snip>

Best Regards
---
Mattias Konradsson


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread