You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Upayavira <uv...@upaya.co.uk> on 2004/01/16 10:31:45 UTC
JX and nodes with appostrophes
I'm using jxtemplate with an entry like #{./title/text()}. When the text
of the node includes an apostrophe, I need to use
#{./title/text()}#{./title/text()[2]}#{./title/text()[3]} to get the
full text.
Is this correct behaviour?
Regards, Upayavira
Re: JX and nodes with appostrophes
Posted by Joerg Heinicke <jo...@gmx.de>.
On 19.01.2004 21:36, Christopher Oliver wrote:
>>> It appears that your DOM object contains multiple text nodes under
>>> the title element. How was it created? Can't you just use #{./title}
>>> or #{string(./title)}?
>>
>> But even with mixed content text() should return all text nodes. And
>> how is it related to the postrophes? Sounds weird and more like a bug.
>>
> I guess it is a bit weird. But with JXPath, the caller has to decide
> whether you want to treat the result of the evaluation as a single node
> (getPointer(), getNode()) or as a node set (iteratePointers(),
> iterate()). JXTemplate uses the former except in <forEach>. However, by
> explicitly utilizing the string() function you can convert a node set to
> a string value within the expression itself to overcome the single node
> behavior.
Ah, I see, thanks for the info.
Joerg
Re: JX and nodes with appostrophes
Posted by Christopher Oliver <re...@verizon.net>.
Joerg Heinicke wrote:
> On 16.01.2004 17:28, Christopher Oliver wrote:
>
>> It appears that your DOM object contains multiple text nodes under
>> the title element. How was it created? Can't you just use #{./title}
>> or #{string(./title)}?
>
>
> But even with mixed content text() should return all text nodes. And
> how is it related to the postrophes? Sounds weird and more like a bug.
>
> Joerg
>
I guess it is a bit weird. But with JXPath, the caller has to decide
whether you want to treat the result of the evaluation as a single node
(getPointer(), getNode()) or as a node set (iteratePointers(),
iterate()). JXTemplate uses the former except in <forEach>. However, by
explicitly utilizing the string() function you can convert a node set to
a string value within the expression itself to overcome the single node
behavior.
Chris
Re: JX and nodes with appostrophes
Posted by Joerg Heinicke <jo...@gmx.de>.
On 16.01.2004 17:28, Christopher Oliver wrote:
> It appears that your DOM object contains multiple text nodes under the
> title element. How was it created?
> Can't you just use #{./title} or #{string(./title)}?
But even with mixed content text() should return all text nodes. And how
is it related to the postrophes? Sounds weird and more like a bug.
Joerg
> Upayavira wrote:
>
>> I'm using jxtemplate with an entry like #{./title/text()}. When the
>> text of the node includes an apostrophe, I need to use
>> #{./title/text()}#{./title/text()[2]}#{./title/text()[3]} to get the
>> full text.
>>
>> Is this correct behaviour?
>>
>> Regards, Upayavira
Re: JX and nodes with appostrophes
Posted by Upayavira <uv...@upaya.co.uk>.
Oops. Just found this in my unsent messages...
Christopher Oliver wrote:
> It appears that your DOM object contains multiple text nodes under the
> title element. How was it created?
Read from a XIndice database.
> Can't you just use #{./title} or #{string(./title)}?
Yup, guess I could. #{./title} returned <title>Didn't the
lord...</title>, but string() worked. Thanks.
Upayavira
Re: JX and nodes with appostrophes
Posted by Christopher Oliver <re...@verizon.net>.
It appears that your DOM object contains multiple text nodes under the
title element. How was it created?
Can't you just use #{./title} or #{string(./title)}?
Upayavira wrote:
> I'm using jxtemplate with an entry like #{./title/text()}. When the
> text of the node includes an apostrophe, I need to use
> #{./title/text()}#{./title/text()[2]}#{./title/text()[3]} to get the
> full text.
>
> Is this correct behaviour?
>
> Regards, Upayavira
>
>
>
>