stef wendell, xml%%%stef wendell - Re: Catch ALL

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

Re: Catch ALL | Failed template rule

Subject: Re: Catch ALL | Failed template rule
From: Stef <stef@xxxxxxxxx>
Date: Tue, 22 Mar 2005 15:20:00 -0500
stef wendell
On Tue, Mar 22, 2005 at 07:59:15PM -0000, Michael Kay wrote:
> > I guess I was looking for the
> > cleanest way to exercise this.  I guess it would be this:
> > <xsl:apply-template select="not(foo/bar[@a='b'])" 
> > mode="unmatchedresults"/>
> 
> No, the result of the selection has to be a set of nodes, it can't be a
> boolean.
> 
> The idea in your head of invoking a template rule if something isn't there
> is not a ridiculous one, but it's something that the language doesn't
> support, and couldn't be made to support without introducing some new
> fundamental concepts. So the best one can say is: it ain't going to happen;
> find another route to your destination.
> 

Jumping in at the eleventh hour and probably am hugely
wrong here, but, wouldn't the following work ?

<xsl:apply-template select="*[not(foo/bar[@a='b'])]" mode="unmatchedresults"/>

This would match any node that did not have the foo/bar
entity with an attribute of a that was b. you would (of
course) need to provide some other search criteria such
as name()="corefoo" so that it didn't match elements
you were not interested in.

As a sidenote, I have used the following in my xslt to
match any sub-element that was -not- a prev, next or
alternativenames

<xsl:for-each select="*[not(name()='prev') and not(name()='next') and no
t(name()='alternativenames')]">

Is there any 'cleaner' or 'saner' way to write this ? 


again, apologies if this is not what was asked for,
I am simply trying to offer something that has worked
for me in a somewhat similiar fashion.

regards
Steph

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.