RE: [xsl] Multiple level filtering with XSLT

Subject: RE: [xsl] Multiple level filtering with XSLT
From: "Jeff Cann" <Jeff.Cann@xxxxxxxxxxxxxxx>
Date: Sat, 24 Jul 2004 10:44:29 +0100
Please read the disclaimer at the bottom of this e-mail.

Thanks David. This worked a treat!
Much appreciated.


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: 22 July 2004 16:42
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Multiple level filtering with XSLT

            <xsl:when test="local-name()='c'">
                <xsl:if test="not(@x=1)">


            <xsl:when test="local-name()='c'">
                <xsl:if test="not(@x=1) and (not (d) or d[@x&lt;7])">

however why match on * and then have a big xsl:choose switch, especially
one using local-name() It's almost always better to use
 <xsl:when test="self::c">
rather than
 <xsl:when test="local-name()='c'">

and in this case you could just use template matching which would make
it much easier to swap new filters in or out:

 <xsl:template match="*">
                    <xsl:copy-of select="@*"/>

<!-- empty templates for filters -->

<xsl:template match="c[@x=1 or not(*[not(self::d[@x&gt;=7)] ])]"/>

<xsl:template match="d[@x&gt;=7]"/>


This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

This email is intended for the named recipient(s) only. Its contents
are  confidential and may only be retained by the named recipient(s)
and may only be copied or  disclosed  with the consent of
LCH.Clearnet Limited.   If you are not an intended recipient please
delete this e-mail and notify postmaster@xxxxxxxxxxxxxxxx

The contents  of this  email are  subject to  contract in all cases,
and LCH.Clearnet Limited makes no contractual commitment save where
confirmed by hard copy.  LCH.Clearnet Limited accepts no liability,
including liability for negligence, in respect of any statement in
this email.

LCH.Clearnet Limited, Registered Office: Aldgate House,
33 Aldgate High Street, London EC3N 1EA.    Recognised as a Clearing
House under the Financial Services & Markets Act 2000. Reg in England No.25932
Telephone: +44 20 7426 7000              Internet:

Current Thread