You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ypomonh <yp...@freemail.gr> on 2007/05/11 16:54:01 UTC

(newbie) Access parameter passed to an XSL transformation from stylesheet

I have a simple pipelineQ

        <map:pipeline>
            <map:match pattern="patternA">
                <map:generate src="cocoon:/patternB"/>
                <map:transform src="style.xsl">
                    <map:parameter name="someParam" 
value="cocoon:/patternC"/>
                </map:transform>
                <map:serialize type="xml"/>
            </map:match>
        </map:pipeline>

and I want to handle the parameter "someParam" in my style.xsl:

    <xsl:variable name="myVariable">
        <xsl:value-of select="someParam/nodeA"/>
    </xsl:variable>

but it returns empty.

What is the correct way to access a parameter passed to an XSL 
transformation from within the XSL stylesheet..?


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


Re: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by ypomonh <yp...@freemail.gr>.
Jasha Joachimsthal wrote:
> Thinking further on your problem, if you need the input from other pipelines, why don't you use an aggregate?


Thanks Jasha, it was that simple after all :)


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


RE: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by Jasha Joachimsthal <j....@hippo.nl>.
Thinking further on your problem, if you need the input from other pipelines, why don't you use an aggregate?

Like

<map:pipeline>
  <map:match pattern="patternA">
    <map:aggregate element="root>
      <map:part element="patternB" src="cocoon:/patternB"/>
      <map:part element="patternC" src="cocoon:/patternC"/>
    </map:aggregate>
    <map:transform src="style.xsl"/>
    <map:serialize type="xml"/>
  </map:match>
</map:pipeline>

Now you have all information from both patternB and patternC at the moment of the XSLT transformation.

Jasha

-----Original Message-----
From:	Jasha Joachimsthal
Sent:	Sat 5/12/2007 9:28 AM
To:	users@cocoon.apache.org
Cc:	
Subject:	RE: (newbie) Access parameter passed to an XSL transformation from stylesheet

Have a look at the XMLFileModule [1] 
Then you can use <map:parameter name="someParam" value="{myModule:/someParam/nodeA}"/> in your pipeline.

[1] http://wiki.apache.org/cocoon/InputModules/

Regards,

Jasha

-----Original Message-----
From:	ypomonh [mailto:ypomonh@freemail.gr]
Sent:	Fri 5/11/2007 5:52 PM
To:	users@cocoon.apache.org
Cc:	joerg.heinicke@gmx.de
Subject:	Re: (newbie) Access parameter passed to an XSL transformation from stylesheet

Joerg Heinicke wrote:
> On 11.05.2007 16:54, ypomonh wrote:
>> I have a simple pipelineQ
>>
>>        <map:pipeline>
>>            <map:match pattern="patternA">
>>                <map:generate src="cocoon:/patternB"/>
>>                <map:transform src="style.xsl">
>>                    <map:parameter name="someParam" 
>> value="cocoon:/patternC"/>
>>                </map:transform>
>>                <map:serialize type="xml"/>
>>            </map:match>
>>        </map:pipeline>
>>
>> and I want to handle the parameter "someParam" in my style.xsl:
>>
>>    <xsl:variable name="myVariable">
>>        <xsl:value-of select="someParam/nodeA"/>
>>    </xsl:variable>
>>
>> but it returns empty.
>>
>> What is the correct way to access a parameter passed to an XSL 
>> transformation from within the XSL stylesheet..?
>
> You are only injecting a string, not the content of the pipeline 
> cocoon:/patternC. Have a look on IncludeTransformer.

Joerg I supposed you meant "CInclude Transformer", so I just read 
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html and I 
understood that I could first do my XSL transformation leaving a:

    <cinclude:include src="cocoon:/patternC"/>

somewhere in the output and continue the pipeline with a CInclude 
transformation that would fetch the date from cocoon:/patternC.



Besides the fact that it seems a bit complicated, I cannot use the 
element cinclude:include since need the fetched data inside an attribute:

    <elem someAttr="$myVariable"/>

and <elem someAttr="<cinclude:include src="cocoon:/patternC"/>"/> is 
obviously wrong.





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






RE: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by Jasha Joachimsthal <j....@hippo.nl>.
Have a look at the XMLFileModule [1] 
Then you can use <map:parameter name="someParam" value="{myModule:/someParam/nodeA}"/> in your pipeline.

[1] http://wiki.apache.org/cocoon/InputModules/

Regards,

Jasha

-----Original Message-----
From:	ypomonh [mailto:ypomonh@freemail.gr]
Sent:	Fri 5/11/2007 5:52 PM
To:	users@cocoon.apache.org
Cc:	joerg.heinicke@gmx.de
Subject:	Re: (newbie) Access parameter passed to an XSL transformation from stylesheet

Joerg Heinicke wrote:
> On 11.05.2007 16:54, ypomonh wrote:
>> I have a simple pipelineQ
>>
>>        <map:pipeline>
>>            <map:match pattern="patternA">
>>                <map:generate src="cocoon:/patternB"/>
>>                <map:transform src="style.xsl">
>>                    <map:parameter name="someParam" 
>> value="cocoon:/patternC"/>
>>                </map:transform>
>>                <map:serialize type="xml"/>
>>            </map:match>
>>        </map:pipeline>
>>
>> and I want to handle the parameter "someParam" in my style.xsl:
>>
>>    <xsl:variable name="myVariable">
>>        <xsl:value-of select="someParam/nodeA"/>
>>    </xsl:variable>
>>
>> but it returns empty.
>>
>> What is the correct way to access a parameter passed to an XSL 
>> transformation from within the XSL stylesheet..?
>
> You are only injecting a string, not the content of the pipeline 
> cocoon:/patternC. Have a look on IncludeTransformer.

Joerg I supposed you meant "CInclude Transformer", so I just read 
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html and I 
understood that I could first do my XSL transformation leaving a:

    <cinclude:include src="cocoon:/patternC"/>

somewhere in the output and continue the pipeline with a CInclude 
transformation that would fetch the date from cocoon:/patternC.



Besides the fact that it seems a bit complicated, I cannot use the 
element cinclude:include since need the fetched data inside an attribute:

    <elem someAttr="$myVariable"/>

and <elem someAttr="<cinclude:include src="cocoon:/patternC"/>"/> is 
obviously wrong.





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





Re: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by ypomonh <yp...@freemail.gr>.
Joerg Heinicke wrote:
> On 11.05.2007 16:54, ypomonh wrote:
>> I have a simple pipelineQ
>>
>>        <map:pipeline>
>>            <map:match pattern="patternA">
>>                <map:generate src="cocoon:/patternB"/>
>>                <map:transform src="style.xsl">
>>                    <map:parameter name="someParam" 
>> value="cocoon:/patternC"/>
>>                </map:transform>
>>                <map:serialize type="xml"/>
>>            </map:match>
>>        </map:pipeline>
>>
>> and I want to handle the parameter "someParam" in my style.xsl:
>>
>>    <xsl:variable name="myVariable">
>>        <xsl:value-of select="someParam/nodeA"/>
>>    </xsl:variable>
>>
>> but it returns empty.
>>
>> What is the correct way to access a parameter passed to an XSL 
>> transformation from within the XSL stylesheet..?
>
> You are only injecting a string, not the content of the pipeline 
> cocoon:/patternC. Have a look on IncludeTransformer.

Joerg I supposed you meant "CInclude Transformer", so I just read 
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html and I 
understood that I could first do my XSL transformation leaving a:

    <cinclude:include src="cocoon:/patternC"/>

somewhere in the output and continue the pipeline with a CInclude 
transformation that would fetch the date from cocoon:/patternC.



Besides the fact that it seems a bit complicated, I cannot use the 
element cinclude:include since need the fetched data inside an attribute:

    <elem someAttr="$myVariable"/>

and <elem someAttr="<cinclude:include src="cocoon:/patternC"/>"/> is 
obviously wrong.





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


Re: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by Joerg Heinicke <jo...@gmx.de>.
On 11.05.2007 16:54, ypomonh wrote:
> I have a simple pipelineQ
> 
>        <map:pipeline>
>            <map:match pattern="patternA">
>                <map:generate src="cocoon:/patternB"/>
>                <map:transform src="style.xsl">
>                    <map:parameter name="someParam" 
> value="cocoon:/patternC"/>
>                </map:transform>
>                <map:serialize type="xml"/>
>            </map:match>
>        </map:pipeline>
> 
> and I want to handle the parameter "someParam" in my style.xsl:
> 
>    <xsl:variable name="myVariable">
>        <xsl:value-of select="someParam/nodeA"/>
>    </xsl:variable>
> 
> but it returns empty.
> 
> What is the correct way to access a parameter passed to an XSL 
> transformation from within the XSL stylesheet..?

You are only injecting a string, not the content of the pipeline 
cocoon:/patternC. Have a look on IncludeTransformer.

Joerg

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


Re: AW: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by ypomonh <yp...@freemail.gr>.
Urs Iwert wrote:
> Just add a line for each parameter in the xsl stylesheet
>
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet	version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
>   <xsl:param name="someParam"/>
>   <xsl:param name="otherParam"/>
>
>   <xsl:template match="abct">
>     <xsl:if test="$someParam='cocoon:/patternC' ">
>       <dosomthing />
>     </xsl:if>
>   </xsl:template>
>   

Hi Urs!

Maybe I didn't make it clear but I want to have the content of the 
pipeline cocoon:/patternC and not the string "cocoon:/patternC"

>
> UI
>
> -----Ursprüngliche Nachricht-----
> Von: ypomonh [mailto:ypomonh@freemail.gr] 
> Gesendet: Freitag, 11. Mai 2007 16:54
> An: users@cocoon.apache.org
> Betreff: (newbie) Access parameter passed to an XSL transformation from stylesheet
>
> I have a simple pipelineQ
>
>         <map:pipeline>
>             <map:match pattern="patternA">
>                 <map:generate src="cocoon:/patternB"/>
>                 <map:transform src="style.xsl">
>                     <map:parameter name="someParam" value="cocoon:/patternC"/>
>                      <map:parameter name="otherParam" value="cocoon:/patternC"/>
>                 </map:transform>
>                 <map:serialize type="xml"/>
>             </map:match>
>         </map:pipeline>
>
> and I want to handle the parameter "someParam" in my style.xsl:
>
>     <xsl:variable name="myVariable">
>         <xsl:value-of select="someParam/nodeA"/>
>     </xsl:variable>
>
> but it returns empty.
>
> What is the correct way to access a parameter passed to an XSL transformation from within the XSL stylesheet..?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
>   



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


AW: (newbie) Access parameter passed to an XSL transformation from stylesheet

Posted by Urs Iwert <ur...@sysinf.ch>.
Just add a line for each parameter in the xsl stylesheet


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet	version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
  <xsl:param name="someParam"/>
  <xsl:param name="otherParam"/>

  <xsl:template match="abct">
    <xsl:if test="$someParam='cocoon:/patternC' ">
      <dosomthing />
    </xsl:if>
  </xsl:template>


UI

-----Ursprüngliche Nachricht-----
Von: ypomonh [mailto:ypomonh@freemail.gr] 
Gesendet: Freitag, 11. Mai 2007 16:54
An: users@cocoon.apache.org
Betreff: (newbie) Access parameter passed to an XSL transformation from stylesheet

I have a simple pipelineQ

        <map:pipeline>
            <map:match pattern="patternA">
                <map:generate src="cocoon:/patternB"/>
                <map:transform src="style.xsl">
                    <map:parameter name="someParam" value="cocoon:/patternC"/>
                     <map:parameter name="otherParam" value="cocoon:/patternC"/>
                </map:transform>
                <map:serialize type="xml"/>
            </map:match>
        </map:pipeline>

and I want to handle the parameter "someParam" in my style.xsl:

    <xsl:variable name="myVariable">
        <xsl:value-of select="someParam/nodeA"/>
    </xsl:variable>

but it returns empty.

What is the correct way to access a parameter passed to an XSL transformation from within the XSL stylesheet..?


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


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