YES! That worked!

Thank you very much Joerg

----- Original Message -----
From: "Joerg Heinicke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 25, 2003 1:31 PM
Subject: Re: XPath problems in Cocoon?


Does this help?

select="a[following-sibling::node()[normalize-space() or
self::*][1][self::a]]"

First all non-whitespace-character text nodes and all elements are
selected. From these one the first one is tested to be an <a/>.

Regards,

Joerg

Anna Afonchenko wrote:
> 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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to