cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Mayring <>
Subject Re: new taglib nearly ready
Date Thu, 06 Jul 2000 11:02:47 GMT
Jeremy Quinn wrote:
> Using XPath means that your query could get multiple hits.
> It is obvious that if you are *reading*, this is a useful thing. But if you
> are *writing* ..... what should the TagLib do?
> For instance, let's say I am doing a copy ... I want to archive what I am
> changing ....
>      <xfp:write as="node" to="archive" select="*/title">
>           <xfp:read select="*/title" from="resource" as="node">
>      </xfp:write>
> This copies the node called "title" from one file to another, OK?
> So what would happen if there are several titles?
> More specifically, what should happen if the write XPath was phrased in
> such a way that it selects several *discontinuous* Nodes?
> At the moment, if someone specifies an XPath for a write, that returns more
> than one Hit, I return an error.

How about this idea: you write a method write_one_node that writes out
one node (plus children, perhaps). If you have an XPATH expression that
selects several nodes, you just call that method several times. Whenever
the XPATH doesn't work in the target file, your write_one_node method
returns an error.


Ulrich Mayring
DENIC eG, Systementwicklung

View raw message