You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by pi...@crpht.lu on 2001/02/08 17:12:20 UTC

Re: XPath with FP Taglib

Hi,

I was just reading the mail archive about FP, and I have had a look at
Ulrich Mayring's problem about adding an element (item) at the end
of a list  (27-10-2000 : sorry, i'm a little late
to get in the discussion)

I work here with Cocoon 1.8.1/Apache1.3.14/Jserv and i have the same
problem.

Jeremy Quinn has closed the discussion topic by saying that he would have a
look on it ...

Have you found a solution Jeremy ?
Or do I have to wait for FP 2.0 ?

Thanks in advance for your help
Best regards
Pierre

PS : sorry for my bad english
----------------------------------------------------------------------------------------
Sorry to be such a pest, Jeremy, in my case this doesn't work. Here's
what I have in my Resource as XPATH:

<fp:resource-node>/root/item[id=count(//item)]</fp:resource-node>
<fp:default-mode>insert-after</fp:default-mode>

This selects the last item, the ids are numbered from 1 to 18 (which is
currently the last item). Now I do, as you suggested:

<fp:write to="resource" select="item">
...
</fp:write>

This inserts an empty <item/> tag into the last item, not after it. It
looks like this:

<item>
<id>18</id>
...
<item/><!-- this was inserted -->
</item>

But of course I want the item to go after item #18. If I just set the
XPATH in the resource to /root, then it doesn't work either. I get an
error message that says fp cannot write to multiple selected nodes. This
is sensible, as there are 18 item nodes. But selecting one of those 18
items will insert the new item INTO it, instead of AFTER it.

Ulrich
-----------------------------------------------------------------------