xsl-list
[Top] [All Lists]

RE: Multiple level filtering with XSLT

2004-07-24 02:44:29
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please read the disclaimer at the bottom of this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Thanks David. This worked a treat!
Much appreciated.

Regards,
Jeff.

-----Original Message-----
From: David Carlisle [mailto:davidc(_at_)nag(_dot_)co(_dot_)uk]
Sent: 22 July 2004 16:42
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Multiple level filtering with XSLT



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

to

            <xsl:when test="local-name()='c'">
                <xsl:if test="not(@x=1) and (not (d) or d[(_at_)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>
                    <xsl:copy-of select="@*"/>
                    <xsl:apply-templates/>
                </xsl:copy>
 </xsl:template>

<!-- empty templates for filters -->

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

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


David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



**********************************************************************
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(_at_)lchclearnet(_dot_)com(_dot_)

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: http://www.lchclearnet.com
**********************************************************************



<Prev in Thread] Current Thread [Next in Thread>