cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anna Afonchenko" <a...@ubaccess.com>
Subject Re: XPath problems in Cocoon?
Date Tue, 25 Feb 2003 09:13:16 GMT
Thanks for answering
I agree that my expression is not the cleanest, but it doesn't work in
cocoon anyway :-(
I can't understand, why it is so hard to express some not-so-difficult
conditions.
I am trying to select all a nodes that are followed by another a node
without anything in between, except white spaces. I understand that my
problem is white spaces that are not ignored in any parser except for MSXML.
Example:
for <a />  <a/> or <a/><a/> I want my expression to pick the first
a.
for <a/>text<a/> or <a/><br/><a/> I do not want my expression
to pick the a.

I don't want to ignore any text nodes, just the whitespace-only ones.
Expression //a[following-sibling::*[1][self::a]] will select also a nodes
woth some simple text in between, and I do not want it.
I don't believe that this should be that complicated, but the fact is that I
cannot manage to construct the expression that will choose exactly what I
need, no more, no less.

Sorry to drag this thread for so long, but maybe you can help me a little
bit more with this and help me to find the right expression that will work
in Cocoon?

Thank you very very much for help.
I appreciate it very much.

Anna
----- Original Message -----
From: "J.Pietschmann" <j3322ptm@yahoo.de>
To: <cocoon-users@xml.apache.org>
Sent: Monday, February 24, 2003 9:21 PM
Subject: Re: XPath problems in Cocoon?


Anna Afonchenko wrote:
> But when I tried to apply this stylesheet using cocoon, I still got the
> empty root element <root/  as a result.

That's because strip-space doesn't apply if the input is delivered
through a SAX pipeline (although the spec is a bit ambiguous about
this.

Actually, your expression is ugly. What's wrong with
  select="a[following-sibling::*[1][self::a]]"
This means "select a elements where the following element
(disregarding any text node) is also an a element."
This is not quite equivalent to your expression but will give
the same result for your XML source, and it will work regardless
whether whitespace nodes are stripped.
There's half a zillion other possibilities to express the same
or similar conditions. If you give a description of the effect
you want to achieve, a proper expression can be formulated.

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message