[xsl] conditional tree variables

Subject: [xsl] conditional tree variables
From: "Mattias Konradsson" <preacher@xxxxxxxxxxx>
Date: Sat, 26 May 2001 16:25:27 +0200
Hmm, I want a variable to contain a different nodeset depending on some
conditions, using  a where-clause surrounding the variable doesn't work of
course because of scope, but shouldnt this work?

      <xsl:variable name="selection_all" select="//header[Sender =
$current_user]"/>
      <xsl:variable name="selection_unread"
select="$selection_all[not(DateRead)]"/>
      <xsl:variable name="selection_unreplied"
select="$selection_all[RepliedTo = 'False']"/>

      <xsl:variable name="selection">
           <xsl:choose>
                <xsl:when test="filter='unread'"><xsl:copy-of
select="$selection_unread"/></xsl:when>
                <xsl:when test="filter='unreplied'"><xsl:copy-of
select="$selection_unreplied" /></xsl:when>
                <xsl:otherwise><xsl:copy-of
select="$selection_all"/></xsl:otherwise>
           </xsl:choose>
      </xsl:variable>

Best Regards
---
Mattias Konradsson



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


Current Thread