RE: [xsl] conditional tree variables

Subject: RE: [xsl] conditional tree variables
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Sat, 26 May 2001 17:29:30 +0100
> 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?

the only problem with your solution is that you create copies of the
original nodes rather than references to them.

Try instead:

<xsl:variable name="selection"
	select="$selection_unread[filter='unread'] |
 		  $selection_unreplied[filter='unreplied'] |
		  $selection_all[not(filter='unread' or filter='unreplied')]"/>

Mike Kay

>
>       <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
>


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


Current Thread