You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by David Arnold <da...@starnix.com> on 2000/11/29 19:54:24 UTC

FP taglib bug

I've been trying to use FP to write some new "records" to an XML file.  
I understand that an <fp:write> tag is supposed to create any nodes 
needed to create the final node of the select clause.  My problem is 
that fp:write doesn't actually do this - it writes all nodes as children 
of the resource node. 

I've attached the patch (to fpResource.java) to get things working properly.

An example:

<fp:resource id="MYRES">
   <fp:resource-file>file.xml</fp:resource-file>
   <fp:resource-node>LEVELONE[position()=<request:get-parameter 
name="levelone"/>]</fp:resource-node>
   <fp:default-mode>insert-before</fp:default-mode>
</fp:resource>

<fp:write select="DATA/SUBDATA" to="MYRES">
   <request:get-parameter name="subdata"/>
</fp:write>

would take a file.xml that looks like:

<ROOT>
   <LEVELONE>
       <DATA>Filler</DATA>
   </LEVELONE>
</ROOT>

and turn it into:

<ROOT>
   <LEVELONE>
       <SUBDATA>Filler</SUBDATA>
   </LEVELONE>
   <LEVELONE>
       <DATA>Filler</DATA>
   </LEVELONE>
</ROOT>

instead of:

<ROOT>
   <LEVELONE>
       <DATA>
            <SUBDATA>Filler</SUBDATA>
       </DATA>
   </LEVELONE>
   <LEVELONE>
       <DATA>Filler</DATA>
   </LEVELONE>
</ROOT>

D.

-- 
David Arnold <da...@starnix.com>                               starnix inc.
tollfree: 1-87-pro-linux                        thornhill, ontario, canada
http://www.starnix.com              professional linux services & products