catch all did match, xml%%%catch all did match - 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: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 22 Mar 2005 16:02:21 -0500
catch all did match
Hi Stef,

At 03:20 PM 3/22/2005, you wrote:
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"/>


No, this matches an element (*) that does not have a foo child with a bar child with @a='b'.

What you are trying to express would probably be

*[not(self::bar[parent::foo][@a='b']

which would match any element not itself a bar with a foo parent and an @a='b'.

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.

Yes, exactly.


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 ?

Yes, an XPath junkie would probably prefer


*[not(self::prev|self::next|self::alternativenames)]

which will select any child element not itself a prev, next or alternativesnames.

We generally like to leave name testing for the Perl hackers. :->

Cheers,
Wendell

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.

Not a problem. The bottom line is, don't think about matching without thinking about selecting. Match is only the Yin to the select's Yang.


Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

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.