You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "GRUSER, Sébastien" <SG...@EKIP.fr> on 2001/04/02 10:01:16 UTC

FP taglig

Hello,
I try to find other examples of <FP> than the little one that comes with
Cocoon.
There are "add" & "edit" example, but "delete" is missing !
And what about more complicated examples ?

Thanks for your help.

Sébastien

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: FP taglig

Posted by simone cecchini <si...@kiosco.org>.
At 21:06 4/2/01 +0100, you wrote:
>Hi,
>
>I've been trying out FP and would like to edit a spreadsheet with it. My 
>problem is that all my cells have the same name of "day". So I would 
>like to map all the "day" values in the reply sequentially to all the 
>cells of the same name in the xml spread sheet. Any ideas - or is this 
>another one for the future?

if your problem is writing the following "cell" elements, or something similar
<row>
	<cell>1</cell>
	<cell>2</cell>
	<cell>3</cell>
</row>

i think you should try to do something like

for( int counter = termsList.size() - 1; counter &gt;= 0; counter-- ) {	// iterate over the list of cells
	if( counter &lt; termsList.size() - 1 ) {					// write the n cells, n>1
		<fp:resource id="current-article">
			<fp:resource-file><xsp:expr>fileNamePath</xsp:expr></fp:resource-file>
			<fp:resource-node>/journal/article/classification/term[ ancestor::article/@id='<xsp:expr>queryKeyPass</xsp:expr>' ]</fp:resource-node>
			<fp:default-mode>insert-before</fp:default-mode>
		</fp:resource>
		<fp:write to="current-article" select=".">
			<fp:child>
				<xsp:expr>String.valueOf( termsList.get(counter) )</xsp:expr>
			</fp:child>
		</fp:write>
		<fp:commit id="current-article"/>		// a way to force a 'save' on the xml file
	}
	else {										// write the first 'cell' element
		<fp:write to="journal" select="./classification">
			<fp:child/>
		</fp:write>
		<fp:write to="journal" select="./classification/term">
			<fp:child>
				<xsp:expr>String.valueOf( termsList.get(counter) )</xsp:expr>
			</fp:child>
		</fp:write>
		<fp:commit id="journal"/>
	}
}

it may be a bit crazy, but it works.

>Regards,
>Pete Hargreaves.
>
>Ulrich Mayring wrote:
>
>> "GRUSER, Sébastien" wrote:
>> 
>>> Hello,
>>> I try to find other examples of <FP> than the little one that comes with
>>> Cocoon.
>>> There are "add" & "edit" example, but "delete" is missing !
>>> And what about more complicated examples ?

there is a way to delete nodes: you have to use 'remove' as "default mode" when creating the resource (i discovered it while looking at the code of the taglib). imho, the code of the taglib is not very clear. e.g.: to delete a tag, you have to write the following

<fp:resource id="edited-journal">
	<fp:resource-file><xsp:expr>fileNamePath</xsp:expr></fp:resource-file>
	<fp:resource-node>/journal/article[ @id = '<xsp:expr>articleID</xsp:expr>']</fp:resource-node>
	<fp:default-mode>remove</fp:default-mode>
</fp:resource>
<fp:write to="edited-journal" select="."/>

maybe this is due to a lack of structure in the way things are set up.

>> 
>> FP really needs an overhaul, you identified the problem areas :)

i definetly agree on that. recently, i had to use it to let users edit an xml file. i have extended the taglib to meet my needs:
- 'commit' changes over edited trees, without having to wait for the end of the code
- 'create' a new file
- write a node, along with its attributes and not just a 'flat' node
(it would be great, to find a way of writing an entire tree fragment)
but - actually - i am not sure that a fix is the better solution.

>> I'd delve into it, but I am still not quite sure if it is "the right
>> thing to do". I think we need two things:
>> 
>> 1) a programmatic XML editor (some of which FP does)
>> 2) a GUI-based XML editor (which should use the programmatic editor
>> behind the scenes)
>> 
>> So we need to put some kind of hooks/interfaces/API on top of the
>> programmatic editor, preferably in a way that an external GUI-based
>> editor can be used (XMetal or such). If I had had any clue, I'd have
>> taken a stab at it :)
>> 
>> Ulrich
>
>-- 
>Mill-Wheel Cottage, Sandford Lane,
>Woodley, Reading, Berkshire, England, RG5 4TB.
>Tel: +44 (0)118 932 1171, Fax: +44 (0)118 934 2355,
>Email: peter@pdh-online.com
>
>http://pdh-online.com - an introduction.
>http://duty-rota.com - for planning your work rotas.
>http://u-castellu.com - a Corsican holiday villa.
>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <co...@xml.apache.org>
>For additional commands, e-mail: <co...@xml.apache.org>
>
>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: FP taglig

Posted by Peter Hargreaves <pd...@hargre.fsnet.co.uk>.
Hi,

I've been trying out FP and would like to edit a spreadsheet with it. My 
problem is that all my cells have the same name of "day". So I would 
like to map all the "day" values in the reply sequentially to all the 
cells of the same name in the xml spread sheet. Any ideas - or is this 
another one for the future?

Regards,
Pete Hargreaves.

Ulrich Mayring wrote:

> "GRUSER, Sébastien" wrote:
> 
>> Hello,
>> I try to find other examples of <FP> than the little one that comes with
>> Cocoon.
>> There are "add" & "edit" example, but "delete" is missing !
>> And what about more complicated examples ?
> 
> 
> FP really needs an overhaul, you identified the problem areas :)
> 
> I'd delve into it, but I am still not quite sure if it is "the right
> thing to do". I think we need two things:
> 
> 1) a programmatic XML editor (some of which FP does)
> 2) a GUI-based XML editor (which should use the programmatic editor
> behind the scenes)
> 
> So we need to put some kind of hooks/interfaces/API on top of the
> programmatic editor, preferably in a way that an external GUI-based
> editor can be used (XMetal or such). If I had had any clue, I'd have
> taken a stab at it :)
> 
> Ulrich

-- 
Mill-Wheel Cottage, Sandford Lane,
Woodley, Reading, Berkshire, England, RG5 4TB.
Tel: +44 (0)118 932 1171, Fax: +44 (0)118 934 2355,
Email: peter@pdh-online.com

http://pdh-online.com - an introduction.
http://duty-rota.com - for planning your work rotas.
http://u-castellu.com - a Corsican holiday villa.


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: FP taglig

Posted by Ulrich Mayring <ul...@denic.de>.
"GRUSER, Sébastien" wrote:
> 
> Hello,
> I try to find other examples of <FP> than the little one that comes with
> Cocoon.
> There are "add" & "edit" example, but "delete" is missing !
> And what about more complicated examples ?

FP really needs an overhaul, you identified the problem areas :)

I'd delve into it, but I am still not quite sure if it is "the right
thing to do". I think we need two things:

1) a programmatic XML editor (some of which FP does)
2) a GUI-based XML editor (which should use the programmatic editor
behind the scenes)

So we need to put some kind of hooks/interfaces/API on top of the
programmatic editor, preferably in a way that an external GUI-based
editor can be used (XMetal or such). If I had had any clue, I'd have
taken a stab at it :)

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>