cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Mayring <>
Subject Re: XPath with FP Taglib
Date Thu, 26 Oct 2000 15:04:09 GMT
Jeremy Quinn wrote:
> I select the node I want to insert-before (or after) as the context :
>                 <fp:resource id="external-item">
>                         <fp:resource-file>../index.xml</fp:resource-file>
>                         <fp:resource-node>item[position()=<request:get-parameter
> name="item"/>]</fp:resource-node>
>                         <fp:default-mode>insert-before</fp:default-mode>
>                 </fp:resource>
> this says: "make a new node called 'item' inserting it before the node that
> matches the XPath"

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


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">

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

<item/><!-- this was inserted -->

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 Mayring
DENIC eG, Systementwicklung

View raw message