[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi Stef,
At 03:20 PM 3/22/2005, you wrote:
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'.
Yes, exactly.
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. :->
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.
Re: [xsl] Catch ALL | Failed template rule
Subject: Re: [xsl] Catch ALL | Failed template rule From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 22 Mar 2005 16:02:21 -0500 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Catch ALL | Failed templa, Stef | Thread | Re: [xsl] Catch ALL | Failed templa, Wendell Piez |
Re: [xsl] Catch ALL | Failed templa, Stef | Date | Re: [xsl] Catch ALL | Failed templa, Wendell Piez |
Month |