cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Vargas <ardvaark-coc...@procrastinators.org>
Subject Re: Unable to pass inputmodule value as parameter
Date Sun, 10 Oct 2004 21:56:57 GMT
-----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


Mime
View raw message