Re: CATCH ALL

[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: CATCH ALL | template rule (2nd try)

Subject: Re: CATCH ALL | template rule (2nd try)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 18 May 2005 07:17:17 +1000
Re:  CATCH ALL | template rule (2nd try)
On 5/18/05, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> Okay, I am going to try that!  How about this simpler example
> though..., would you mind providing the inverse for this one:
>
> <xsl:template match="A">
> <xsl:copy>
>  <match>
>    <xsl:apply-templates select="B[X[@val=$match_v1]][X[@val=$match_v2]]"/>
>  </match>
>  <exception>
>    <!-- currently, copy of the match above, but would like this to be
> expressed as the exception -->
>    <xsl:apply-templates select="B[X[@val=$match_v1]][X[@val=$match_v2]]"/>
>  </exception>
> </xsl:copy>
> </xsl:template>

N.P.

This can be done mechanically:

 >    <xsl:apply-templates select="B[X[@val=$match_v1]][X[@val=$match_v2]]"/>

  <xsl:variable name="x" select="B[X[@val=$match_v1]][X[@val=$match_v2]]"/>

   <xsl:apply-templates select="node()[not(count(.|$x) = count($x))]"/>


Of course, in XPath 2.0 one will use the except operator:

   <xsl:apply-templates select="node() except $x"/>




Cheers,
Dimitre





>
>
> On 5/17/05, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
> > > <xsl:apply-templates
> > >
select="fx:node-set($interval)//fn:interval[//field[@fieldname='EntityID']=$F
TEInterval_Members][//field[@fieldname='EntityID']=$FTEInterval_JTED_Mains]"
> > > mode="Exceptions" />
> > >
> > > What is the inverse of this?  Which would suffice to be my "CATCH
> > > ALL", in otherwords match everything else where the above combination
> > > fails.
> >
> > fx:node-set($interval)//node()[not(count(. | yourExpression) =
> > count(yourExpression))]
> >
> > generally, if there are two node-sets: $ns1 and $ns2, their set
difference
> >    $ns2 - $ns1
> > is expressed by this XPath expression:
> >
> >    $ns2[not(count(. | $ns1) = count($ns1) ) ]
> >
> > Cheers,
> > Dimitre

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.