|
Subject: [xsl] negate predicate From: "Richard Lewis" <richardlewis@xxxxxxxxxxxxxx> Date: Tue, 14 Dec 2004 14:10:34 +0000 |
I want to select the text of all descendants of a node which *don't*
have an attribute called 'id' (and none of the nodes which are
descendants of nodes with id attributes).
So that, from the following document snipet:
<document>
<section id="first">
<p>Hello, foo bar</p>
<subsection id="bar">
<p>Some stuff</p>
</subsection>
<subsection id="foo">
<p>Some other stuff</p>
</subsection>
</section>
<section id="second">
<subsection id="qwerty">
<p>More text</p>
</subsection>
<p>words, words</p>
</section>
</document>
an XPath expression like:
//section//*[@id = '']/text()
would return: "Hello, foo barwords, words"
and one like:
//subsection//*[@id = '']/text()
would return: "Some stuffSome other stuffMore text"
(I realise that here I could just tell it not to select 'subsection'
elements but my real document has a more complex hierachy including
structural elements which share names with formatting elements [and
which are only distinguished by having an 'id' attribute]).
Thanks for your help,
Richard
--
Richard Lewis
richardlewis@xxxxxxxxxxxxxx
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] Test for leaf node, Robert Soesemann | Thread | Re: [xsl] negate predicate, David Carlisle |
| Re: [xsl] Different (body) layout o, Christian Rosberg | Date | Re: [xsl] number collapsing, Bruce D'Arcus |
| Month |