xsl-list
[Top] [All Lists]

Re: [xsl] Inverse of apply-template select

2011-01-13 14:41:55
Russ,

In select="*[not(self::title)]", the subexpression "not(self::title)" is evaluated relative to each of the nodes selected by the XPath on which the predicate operates (the bracketed expression -- "filter expression" in XPath 2.0 parlance). That is, relative to whatever is selected by "*".

This is so that expressions like "p[@class='big']" (short for "child::p[attribute::class='big']") will work the way we want them to.

Another thing to keep in mind is that the logic of "*[not(self::title)]" works because there's an implicit type cast going on -- "self::title" returns a node set (either empty or not, depending on whether there are any such nodes), which becomes a Boolean true or false, which is then inverted using the Boolean function "not()".

A final note, glossing David -- you never have to say "./title" for the same reason you don't have to say "./././title".

Cheers,
Wendell

On 1/13/2011 3:19 PM, russurquhart1(_at_)verizon(_dot_)net wrote:

That worked, thanks!

btw, why is the self:: axis needed here, but not in the previous select?

Thanks again!

Russ

Jan 13, 2011 07:59:14 PM, xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
wrote:

On 13/01/2011 19:10, Imsieke, Gerrit, le-tex wrote:

You want to select all children who are not either bookinfo or title:


or if you are using xslt2, the more readable

select="* except (bookinfo|title)"

also, to the original poster, you never need start an xpath with ./

David


--~------------------------------------------------------------------
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:
--~--


--~------------------------------------------------------------------
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>
--~--



--
======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================

--~------------------------------------------------------------------
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>
--~--

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