>My assumption is that the DOM is held in memory somewhere after generation and 
>passed to the various transformers before >eventually being serialised. Surely 
>there is a way to access the content of the DOM prior to serialisation. Does 
>anyone >know how?

 Generator generates SAX events, not a DOM.  I had a similar problem where I 
had to choose transformation sequences from the content of the XML stream.  
Problem is that since it's SAX driven, you must see the pipeline as channeling 
events.  As soon as a SAX event is generated, it is passed down the pipeline.  
In fact, your final serializer might be serializing stuff even if the generator 
is still processing the source.  

Components don't read up the whole stream, build a DOM and THEN pass it to the 
next components.  Now, obviously, some transformers might hold up a stream for 
some reason (such as XSLT, but not necessarely), but as far as the pipeline is 
concerned, it's considered a continous stream of events.

To do something base on content of XML, you must use cinclude and pass the 
information to that second pipeline.

The way I deal with this is to have a first pipeline to read the stream and 
prepare a series of 'jobs' (cinclude) that call other pipelines, with relevant 
parameters, that are processing the same file.  The only problem with this 
solution is when the final serializer must be chosen from the content of the 
XML.  Cinclude only works with XML.  In this situation, you have to write your 
own component (most probably a reader component)

Hope I did not confused the issue.

Eric



-----Message d'origine-----
De : Alec Bickerton [mailto:alec.bicker...@minick.net] 
Envoyé : 28 juillet 2010 04:49
À : users@cocoon.apache.org
Objet : Re: Hand over XSL variable value - wrong list?

XML is generated via a generator.

<data>
        <name>file</name>
        <value>Albatross</value>
        <temp.path>/tmp/files/xyz/</temp.path>
</data>

A transformation occurs so that the XML looks like ...

<files>
        <file name="Albatross">/tmp/files/xyz/Albatross</file>
</files>

Later in the pipe, and action could be to do something to the file (Compress it 
for example)

something like <map:act type="doMagic" 
src="{xpath:/files/fi...@name='Albatross']/text()}"}>
        ... do some other stuff...
</map:act>

Having spoken with the OP, theyare looking for a way to pass the value of the 
file element in the transformed XML to the sitemap. Maybe I've missed something 
obvious but I would have thought this functionality would be present in the 
framework.

My assumption is that the DOM is held in memory somewhere after generation and 
passed to the various transformers before eventually being serialised. Surely 
there is a way to access the content of the DOM prior to serialisation. Does 
anyone know how?

Alec,

On 28/07/10 09:32, Jasha Joachimsthal wrote:
> They can inject values from the pipeline to the components, not the 
> other way around. So you can pass a request-parameter value to an XSLT 
> or a global constant to some other component.
> If you need to process something that is based on your content, either 
> call a different pipeline with the include transformer or write your 
> own transformer that handles that part of the XML.
> 
> 
> Jasha Joachimsthal
> 
> j.joachimst...@onehippo.com <mailto:j.joachimst...@onehippo.com> - 
> ja...@apache.org <mailto:ja...@apache.org>
> 
> www.onehippo.com <http://www.onehippo.com> Amsterdam - Hippo B.V. 
> Oosteinde 11 1017 WT Amsterdam +31(0)20-5224466 San Francisco - Hippo 
> USA Inc. 185 H Street, suite B, Petaluma CA 94952
> +1 (707) 7734646
> 
> 
> 
> On 28 July 2010 09:27, florent andré <florent.andre-...@4sengines.com 
> <mailto:florent.andre-...@4sengines.com>> wrote:
> 
>     Depending on your design, you can also use an input Module :
>     http://cocoon.us.apache.org/2.1/userdocs/concepts/modules-ref.html
>     that can "inject" values into pipelines.
> 
>     ++
> 
> 
>     On 26/07/2010 16:36, Boisvert, Eric wrote:
> 
>         it's the right list.
>         Anyone, correct me if I'm wrong, but it cannot be done (not this way
>         anyway). I suspect you want to push a parameter to the sitemap
>         so it can
>         be used to parametrize some other component down the pipeline. If I
>         understand correctly, the all pipeline variables are evaluated
>         before
>         the XML stream has even started to be processed. So you are "too
>         late"
>         for this parameter to have any influence, all the pipeline is
>         already
>         setup. To do such late decision, you need to use cinclude and invoke
>         another pipeline.
>         Hope this help (and is actually the right answer)
>         Cordialement
>         Eric
> 
>         
> ------------------------------------------------------------------------
>         *De :* Immanuel Witschi [mailto:immanuel.wits...@net-m.ch
>         <mailto:immanuel.wits...@net-m.ch>]
>         *Envoyé :* 26 juillet 2010 10:25
>         *À :* users@cocoon.apache.org <mailto:users@cocoon.apache.org>
>         *Objet :* AW: Hand over XSL variable value - wrong list?
> 
>         is this the wrong list for such a question? (this is my first
>         post on
>         this list)
>         thanks
>         br
>         Immanuel
> 
>          
>          
> ------------------------------------------------------------------------
>            *Von:* Immanuel Witschi [mailto:immanuel.wits...@net-m.ch
>         <mailto:immanuel.wits...@net-m.ch>]
>            *Gesendet:* Montag, 26. Juli 2010 14:12
>            *An:* users@cocoon.apache.org <mailto:users@cocoon.apache.org>
>            *Betreff:* AW: Hand over XSL variable value to sitemap 
> param
> 
>            *here an example*
> 
>            <xsl:stylesheet
> 
>            xmlns:xsl=/"http://www.w3.org/1999/XSL/Transform"/
>         version=/"1.0"/
> 
>            //
> 
>          
>          
> xmlns:sessionutils=/"http://whatever/ch.minick.patches.SessionUtils"/
> 
>            //
> 
>            
> xmlns:userutils=/http://whatever/ch.minick.patches.UserUtils/>
> 
>            <xsl:output method=/"xml"/ />
> 
>            <xsl:param name=/"/buttonsize/"/ />
> 
>            <xsl:variable name=/"newbuttonsize"/
>            select=/"//concat(/$/buttonsize,' is big')" />
>            /
> 
>            /how to make $newbuttonsize available in the sitemap as
>            {newbuttonsize} ?/
> 
>            //
> 
>            thanks for any help
> 
>            Immanuel
> 
> 
>              
>          
> ------------------------------------------------------------------------
>                *Von:* Immanuel Witschi [mailto:immanuel.wits...@net-m.ch
>         <mailto:immanuel.wits...@net-m.ch>]
>                *Gesendet:* Montag, 26. Juli 2010 12:00
>                *An:* users@cocoon.apache.org
>         <mailto:users@cocoon.apache.org>
>                *Betreff:* Hand over XSL variable value to sitemap 
> param
> 
>                Hi
>                I need to provide a variable value that is defined inside
>         a XSL
>                transformation to a sitemap action parameter. Is there a
>         way to
>                hand over this value?
>                the opposite way to
>                param somevalue; in the XML
>                best
>                Immi
> 
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
>     <mailto:users-unsubscr...@cocoon.apache.org>
>     For additional commands, e-mail: users-h...@cocoon.apache.org
>     <mailto:users-h...@cocoon.apache.org>
> 
> 


--
---------------------------------------------------
Alec Bickerton
Java Developer

net mobile Schweiz AG
Seestrasse 45
CH - 8702 Zollikon

Tel:      + 41 (0) 44 918 99 99
Fax:     + 41 (0) 44 918 99 98
Direkt:  + 41 (0) 44 918 99 76

Mail: alec.bicker...@net-m.ch
Web:  www.net-m.ch

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to