You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by gerritjan <ge...@mac.com> on 2004/10/10 21:33:37 UTC

Unable to pass inputmodule value as parameter

Hello,

My sitemap looks like:
     <map:match pattern="cdls_artikelen.xml">
       <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
       <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
         <map:parameter name="p_datum" value="{date}"/>
       </map:transform>
       <map:serialize type="xml"/>
     </map:match>

My "style/xsl/artikel_lijst2artikel.xsl" looks like:
<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:dir="http://apache.org/cocoon/directory/2.0">

   <xsl:param name="p_datum"/>

   <xsl:template match="dir:directory" >
     <basis>
     <onderwerpen datum_vandaag="{$p_datum}">
     <xsl:for-each select="dir:file">
        <xsl:variable 
name="xml_bestand">../../content/artikelen/<xsl:value-of 
select="@name"/></xsl:variable>
        <xsl:apply-templates 
select="document($xml_bestand)/child::onderwerpen/child::onderwerp">
          <xsl:with-param name="p_bestand"><xsl:value-of 
select="substring-before(@name,'.xml')"/></xsl:with-param>
        </xsl:apply-templates>
     </xsl:for-each>
     </onderwerpen>
     </basis>
   </xsl:template>

My output looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<basis xmlns:dir="http://apache.org/cocoon/directory/2.0">
   <onderwerpen datum_vandaag="">
     <onderwerp>...
    </onderwerp>
  </onderwerpen>
</basis>

The parameter value does not show up as the attribute value of 
attribute "datum_vandaag"
I tried to replace the {date} (in the sitemap!) with 
{system-property:substring-before(user.home, user.name)}
(used in the cocoon documentation!)
What am I missing?

Gerritjan Koekkoek

Re: Unable to pass inputmodule value as parameter

Posted by Brian Vargas <ar...@procrastinators.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gerritjan,

> That realy helped...

Awesome.

> It's working now, where did you find the specification of these
> properties, I seem to have missed them

I actually poked around in the source code.  The file for the DateInputModule
is /src/java/org/apache/cocoon/components/modules/input/DateInputModule.java.

The source code is the ultimate documentation!

Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: What is this? http://pgp.ardvaark.net

iD8DBQFBcCXZ3YdPnMKx1eMRAvYtAKC60ApI3m6uih5aDJbNu6ddpaEFygCg4f3D
lid2xT0rUr69r0rWhTPr29s=
=msWD
-----END PGP SIGNATURE-----

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


Re: Unable to pass inputmodule value as parameter

Posted by Ralph Goers <Ra...@dslextreme.com>.
The way we handle this sort of thing is to use Cocoon's XPatch ant task to
patch our updates into the cocoon.xconf that is created when cocoon is
built.  That way you don't have to remember anything - your build system
remembers instead.


gerritjan said:
> Does anyone happen to know how to format this date:currentdate
> I get Fri Oct 15 21:23:06 CEST 2004 , and I want 2004-10-15
> I do not want to modify the cocoon.xconf that is delivered with the
> cocoon because I do not want to remember this each time I upgrade
> cocoon...
>
>


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


Re: Unable to pass inputmodule value as parameter

Posted by gerritjan <ge...@mac.com>.
Does anyone happen to know how to format this date:currentdate
I get Fri Oct 15 21:23:06 CEST 2004 , and I want 2004-10-15
I do not want to modify the cocoon.xconf that is delivered with the 
cocoon because I do not want to remember this each time I upgrade 
cocoon...

Gerritjan Koekkoek
Op 15-okt-04 om 20:43 heeft gerritjan het volgende geschreven:

> Brian,
>
> That realy helped...
> It's working now, where did you find the specification of these 
> properties, I seem to have missed them
>
> Thank you very much...
>
> Gerritjan Koekkoek
> Op 15-okt-04 om 20:36 heeft Brian Vargas het volgende geschreven:
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Gerritjan,
>>
>>> You both seem to assume i'm expecting a date in the query string
>>> like: http://yourhost/.../cdls_artikelen.xml?date=something
>>
>> I was assuming that based on the response to which I was responding.  
>> :-)
>>
>>> I wanted to use the DateInputModule which is described at:
>>> http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html
>>>
>>> In my cocoon.xconf this module is present en stated as referable by 
>>> {date}
>>>
>>> can you (or anybody else) see where i'm going wrong!
>>
>> The "date" specified in your cocoon.xconf merely specifies the name 
>> of the
>> module.  You still have to provide it with the name of the module 
>> attribute you
>> want to retrieve.  For the current date, you want the "currentDate" 
>> property.
>>
>> So your sitemap will look like this:
>>
>> <map:match pattern="cdls_artikelen.xml">
>> 	<map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>> 	<map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>> 		<map:parameter name="p_datum" value="{date:currentDate}"/>
>> 	</map:transform>
>> 	<map:serialize type="xml"/>
>> </map:match>
>>
>> Brian
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.4 (MingW32)
>> Comment: What is this? http://pgp.ardvaark.net
>>
>> iD8DBQFBcBjK3YdPnMKx1eMRAushAKDts8TB4S3WniIE2JC7/a9QUTawugCeOMpP
>> Aov4/2Mu/p9GL4S/7XIMZB0=
>> =dKiL
>> -----END PGP SIGNATURE-----
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>

Re: Unable to pass inputmodule value as parameter

Posted by gerritjan <ge...@mac.com>.
Brian,

That realy helped...
It's working now, where did you find the specification of these 
properties, I seem to have missed them

Thank you very much...

Gerritjan Koekkoek
Op 15-okt-04 om 20:36 heeft Brian Vargas het volgende geschreven:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Gerritjan,
>
>> You both seem to assume i'm expecting a date in the query string
>> like: http://yourhost/.../cdls_artikelen.xml?date=something
>
> I was assuming that based on the response to which I was responding.  
> :-)
>
>> I wanted to use the DateInputModule which is described at:
>> http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html
>>
>> In my cocoon.xconf this module is present en stated as referable by 
>> {date}
>>
>> can you (or anybody else) see where i'm going wrong!
>
> The "date" specified in your cocoon.xconf merely specifies the name of 
> the
> module.  You still have to provide it with the name of the module 
> attribute you
> want to retrieve.  For the current date, you want the "currentDate" 
> property.
>
> So your sitemap will look like this:
>
> <map:match pattern="cdls_artikelen.xml">
> 	<map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
> 	<map:transform src="style/xsl/artikel_lijst2artikel.xsl">
> 		<map:parameter name="p_datum" value="{date:currentDate}"/>
> 	</map:transform>
> 	<map:serialize type="xml"/>
> </map:match>
>
> Brian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: What is this? http://pgp.ardvaark.net
>
> iD8DBQFBcBjK3YdPnMKx1eMRAushAKDts8TB4S3WniIE2JC7/a9QUTawugCeOMpP
> Aov4/2Mu/p9GL4S/7XIMZB0=
> =dKiL
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

Re: Unable to pass inputmodule value as parameter

Posted by Brian Vargas <ar...@procrastinators.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gerritjan,

> You both seem to assume i'm expecting a date in the query string
> like: http://yourhost/.../cdls_artikelen.xml?date=something

I was assuming that based on the response to which I was responding.  :-)

> I wanted to use the DateInputModule which is described at:
> http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html
> 
> In my cocoon.xconf this module is present en stated as referable by {date}
> 
> can you (or anybody else) see where i'm going wrong!

The "date" specified in your cocoon.xconf merely specifies the name of the
module.  You still have to provide it with the name of the module attribute you
want to retrieve.  For the current date, you want the "currentDate" property.

So your sitemap will look like this:

<map:match pattern="cdls_artikelen.xml">
	<map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
	<map:transform src="style/xsl/artikel_lijst2artikel.xsl">
		<map:parameter name="p_datum" value="{date:currentDate}"/>
	</map:transform>
	<map:serialize type="xml"/>
</map:match>

Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: What is this? http://pgp.ardvaark.net

iD8DBQFBcBjK3YdPnMKx1eMRAushAKDts8TB4S3WniIE2JC7/a9QUTawugCeOMpP
Aov4/2Mu/p9GL4S/7XIMZB0=
=dKiL
-----END PGP SIGNATURE-----

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


Re: Unable to pass inputmodule value as parameter

Posted by gerritjan <ge...@mac.com>.
Hey thx,

You both seem to assume i'm expecting a date in the query string
like: http://yourhost/.../cdls_artikelen.xml?date=something

I'm not expecting this.
I want to use the cocoon inputmodules
http://cocoon.apache.org/2.1/userdocs/concepts/modules.html
On this page under USE IT... you see the example:
<map:parameter name="users-home-base"
   value="{system-property:substring-before(user.home, user.name)}"/>

I wanted to use the DateInputModule which is described at:
http://cocoon.apache.org/2.1/userdocs/concepts/modules-ref.html

In my cocoon.xconf this module is present en stated as referable by 
{date}

can you (or anybody else) see where i'm going wrong!

Gerritjan Koekkoek
Op 10-okt-04 om 23:56 heeft Brian Vargas het volgende geschreven:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hey,
>
> Another alternative, if your variable is in the query string, is to 
> use the
> Request Parameter input module.  Your sitemap would look something 
> like:
>
> <map:match pattern="cdls_artikelen.xml">
>   <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>   <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>     <map:parameter name="p_datum" value="{request-param:date}"/>
>   </map:transform>
>   <map:serialize type="xml"/>
> </map:match>
>
> This causes the sitemap to ask the input module bound to the 
> "request-param"
> prefix for the value "date."  That input module will, by default, look 
> at the
> query string and pull out the value from there.
>
> Brian
>
> Andre Juffer wrote:
>> Gerrit-Jan,
>>
>> as far as I can see, the parameter 'date' in the sitemap is not set
>> anywhere. I don't see immediately anything wrong in your files. I 
>> assume
>> you are calling this pipeline with something like
>>
>> http://yourhost/.../cdls_artikelen.xml?date=something
>>
>> You probably would need to extract the value of 'date' from the 
>> request.
>> Try to use <map:act type="request">, which makes all request 
>> parameters
>> available to the sitemap:
>>
>> <map:match pattern="cdls_artikelen.xml">
>>   <map:act type="request">
>>     <map:parameter name="parameters" value="true" />
>>     <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>>     <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>>       <map:parameter name="p_datum" value="{date}"/>
>>     </map:transform>
>>     <map:serialize type="xml"/>
>>   </map:act>
>>   .....
>> </map:match>
>>
>> 'date' is set by the action.
>>
>> Alternatively, you could make all request parameters available to the
>> stylesheet artikel_lijst2artikel.xsl, in which case you would not need
>> to set the 'date' in the sitemap.
>>
>> Cheers,
>> Andre.
>>
>> gerritjan wrote:
>>
>>> Hello,
>>>
>>> My sitemap looks like:
>>> <map:match pattern="cdls_artikelen.xml">
>>> <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>>> <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>>> <map:parameter name="p_datum" value="{date}"/>
>>> </map:transform>
>>> <map:serialize type="xml"/>
>>> </map:match>
>>>
>>> My "style/xsl/artikel_lijst2artikel.xsl" looks like:
>>> <xsl:stylesheet version="1.0"
>>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>> xmlns:dir="http://apache.org/cocoon/directory/2.0">
>>>
>>> <xsl:param name="p_datum"/>
>>>
>>> <xsl:template match="dir:directory" >
>>> <basis>
>>> <onderwerpen datum_vandaag="{$p_datum}">
>>> <xsl:for-each select="dir:file">
>>> <xsl:variable 
>>> name="xml_bestand">../../content/artikelen/<xsl:value-of
>>> select="@name"/></xsl:variable>
>>> <xsl:apply-templates
>>> select="document($xml_bestand)/child::onderwerpen/child::onderwerp">
>>> <xsl:with-param name="p_bestand"><xsl:value-of
>>> select="substring-before(@name,'.xml')"/></xsl:with-param>
>>> </xsl:apply-templates>
>>> </xsl:for-each>
>>> </onderwerpen>
>>> </basis>
>>> </xsl:template>
>>>
>>> My output looks like this:
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <basis xmlns:dir="http://apache.org/cocoon/directory/2.0">
>>> <onderwerpen datum_vandaag="">
>>> <onderwerp>...
>>> </onderwerp>
>>> </onderwerpen>
>>> </basis>
>>>
>>> The parameter value does not show up as the attribute value of
>>> attribute "datum_vandaag"
>>> I tried to replace the {date} (in the sitemap!) with
>>> {system-property:substring-before(user.home, user.name)}
>>> (used in the cocoon documentation!)
>>> What am I missing?
>>>
>>> */_Gerritjan Koekkoek_/*
>>
>>
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (MingW32)
> Comment: What is this? http://pgp.ardvaark.net
>
> iD8DBQFBabAp3YdPnMKx1eMRAkFQAKDDqK2OGn2FUpdPBlThl536TcsIPQCfRyRC
> n/PrzTTdpGjnAYBHFd+A/2E=
> =MVFo
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>

Re: Unable to pass inputmodule value as parameter

Posted by Brian Vargas <ar...@procrastinators.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,

Another alternative, if your variable is in the query string, is to use the
Request Parameter input module.  Your sitemap would look something like:

<map:match pattern="cdls_artikelen.xml">
  <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
  <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
    <map:parameter name="p_datum" value="{request-param:date}"/>
  </map:transform>
  <map:serialize type="xml"/>
</map:match>

This causes the sitemap to ask the input module bound to the "request-param"
prefix for the value "date."  That input module will, by default, look at the
query string and pull out the value from there.

Brian

Andre Juffer wrote:
> Gerrit-Jan,
> 
> as far as I can see, the parameter 'date' in the sitemap is not set
> anywhere. I don't see immediately anything wrong in your files. I assume
> you are calling this pipeline with something like
> 
> http://yourhost/.../cdls_artikelen.xml?date=something
> 
> You probably would need to extract the value of 'date' from the request.
> Try to use <map:act type="request">, which makes all request parameters
> available to the sitemap:
> 
> <map:match pattern="cdls_artikelen.xml">
>   <map:act type="request">
>     <map:parameter name="parameters" value="true" />
>     <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>     <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>       <map:parameter name="p_datum" value="{date}"/>
>     </map:transform>
>     <map:serialize type="xml"/>
>   </map:act>
>   .....
> </map:match>
> 
> 'date' is set by the action.
> 
> Alternatively, you could make all request parameters available to the
> stylesheet artikel_lijst2artikel.xsl, in which case you would not need
> to set the 'date' in the sitemap.
> 
> Cheers,
> Andre.
> 
> gerritjan wrote:
> 
>> Hello,
>>
>> My sitemap looks like:
>> <map:match pattern="cdls_artikelen.xml">
>> <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
>> <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
>> <map:parameter name="p_datum" value="{date}"/>
>> </map:transform>
>> <map:serialize type="xml"/>
>> </map:match>
>>
>> My "style/xsl/artikel_lijst2artikel.xsl" looks like:
>> <xsl:stylesheet version="1.0"
>> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> xmlns:dir="http://apache.org/cocoon/directory/2.0">
>>
>> <xsl:param name="p_datum"/>
>>
>> <xsl:template match="dir:directory" >
>> <basis>
>> <onderwerpen datum_vandaag="{$p_datum}">
>> <xsl:for-each select="dir:file">
>> <xsl:variable name="xml_bestand">../../content/artikelen/<xsl:value-of
>> select="@name"/></xsl:variable>
>> <xsl:apply-templates
>> select="document($xml_bestand)/child::onderwerpen/child::onderwerp">
>> <xsl:with-param name="p_bestand"><xsl:value-of
>> select="substring-before(@name,'.xml')"/></xsl:with-param>
>> </xsl:apply-templates>
>> </xsl:for-each>
>> </onderwerpen>
>> </basis>
>> </xsl:template>
>>
>> My output looks like this:
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <basis xmlns:dir="http://apache.org/cocoon/directory/2.0">
>> <onderwerpen datum_vandaag="">
>> <onderwerp>...
>> </onderwerp>
>> </onderwerpen>
>> </basis>
>>
>> The parameter value does not show up as the attribute value of
>> attribute "datum_vandaag"
>> I tried to replace the {date} (in the sitemap!) with
>> {system-property:substring-before(user.home, user.name)}
>> (used in the cocoon documentation!)
>> What am I missing?
>>
>> */_Gerritjan Koekkoek_/*
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: What is this? http://pgp.ardvaark.net

iD8DBQFBabAp3YdPnMKx1eMRAkFQAKDDqK2OGn2FUpdPBlThl536TcsIPQCfRyRC
n/PrzTTdpGjnAYBHFd+A/2E=
=MVFo
-----END PGP SIGNATURE-----

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


Re: Unable to pass inputmodule value as parameter

Posted by Andre Juffer <aj...@sun3.oulu.fi>.
Gerrit-Jan,

as far as I can see, the parameter 'date' in the sitemap is not set 
anywhere. I don't see immediately anything wrong in your files. I assume 
you are calling this pipeline with something like

http://yourhost/.../cdls_artikelen.xml?date=something

You probably would need to extract the value of 'date' from the request. 
Try to use <map:act type="request">, which makes all request parameters 
available to the sitemap:

<map:match pattern="cdls_artikelen.xml">
   <map:act type="request">
     <map:parameter name="parameters" value="true" />
     <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
     <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
       <map:parameter name="p_datum" value="{date}"/>
     </map:transform>
     <map:serialize type="xml"/>
   </map:act>
   .....
</map:match>

'date' is set by the action.

Alternatively, you could make all request parameters available to the 
stylesheet artikel_lijst2artikel.xsl, in which case you would not need 
to set the 'date' in the sitemap.

Cheers,
Andre.

gerritjan wrote:
> Hello,
> 
> My sitemap looks like:
> <map:match pattern="cdls_artikelen.xml">
> <map:generate src="cocoon:/cdls_artikelen_lijst.xml"/>
> <map:transform src="style/xsl/artikel_lijst2artikel.xsl">
> <map:parameter name="p_datum" value="{date}"/>
> </map:transform>
> <map:serialize type="xml"/>
> </map:match>
> 
> My "style/xsl/artikel_lijst2artikel.xsl" looks like:
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:dir="http://apache.org/cocoon/directory/2.0">
> 
> <xsl:param name="p_datum"/>
> 
> <xsl:template match="dir:directory" >
> <basis>
> <onderwerpen datum_vandaag="{$p_datum}">
> <xsl:for-each select="dir:file">
> <xsl:variable name="xml_bestand">../../content/artikelen/<xsl:value-of 
> select="@name"/></xsl:variable>
> <xsl:apply-templates 
> select="document($xml_bestand)/child::onderwerpen/child::onderwerp">
> <xsl:with-param name="p_bestand"><xsl:value-of 
> select="substring-before(@name,'.xml')"/></xsl:with-param>
> </xsl:apply-templates>
> </xsl:for-each>
> </onderwerpen>
> </basis>
> </xsl:template>
> 
> My output looks like this:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <basis xmlns:dir="http://apache.org/cocoon/directory/2.0">
> <onderwerpen datum_vandaag="">
> <onderwerp>...
> </onderwerp>
> </onderwerpen>
> </basis>
> 
> The parameter value does not show up as the attribute value of attribute 
> "datum_vandaag"
> I tried to replace the {date} (in the sitemap!) with 
> {system-property:substring-before(user.home, user.name)}
> (used in the cocoon documentation!)
> What am I missing?
> 
> */_Gerritjan Koekkoek_/*


-- 
Andre H. Juffer              | Phone: +358-8-553 1161
The Biocenter and            | Fax: +358-8-553-1141
     the Dep. of Biochemistry | Email: Andre.Juffer@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/

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