Re: passing parameters to xslt

Christian Stocker <[email protected]> Wed, 25 Jan 2006 11:24:41 +0100
Newsgroups gmane.comp.cms.bitflux.general
Organization Bitflux GmbH
Message-ID <[email protected]>

On 25.1.2006 11:00 Uhr, qMax wrote:
> Hi.
> 
> I'm using my own pipeline like this:
> <map:when test="xmldoc">
>    <map:include label="bxcmsGenerator"/>
>    <map:transform type="xslt" src="{stylesheet}">
>      <!-- some standard parameters here -->
>    </map:transform>
>    <map:include label="standardOutput"/>
> </map:when>
> This pipeline is selected from my plugin xmldoc.
> Stylesheet could be different for each resource, handled by plugin,
> but usually common to collection.
> 
> Now i want to pass _random_ (stylesheet dependant) parameters to this
> stylesheet, configuring them in collection config for whole collection or some
> particular resource (eg: section numbering, TOC generation, etc.)
> 
> I can set up some parameters in .configxml:
> <plugin name="xmldoc">
>   <parameter type="..." name="..." value="..."/>
> </plugin>
> And theres a way to get them in plugin instance: $this->getParameter($this->getCurrentRequest('collUri'),$param_name,$param_type)
> The question is - how to pass them to stylesheet ?

Here's my proposal :) (that doesn't work yet, but shouldn't be too hard
to be implemented)

for .configxml

<plugins>
 <parameter key="param1" name="xsltparams" type="pipeline"
value="somevalue"/>
 <parameter key="param2" name="xsltparams" type="pipeline"
value="someothervalue"/>
  <plugin .....
  </plugin>
</plugins>

and in sitemap.xml

 <map:include label="bxcmsGenerator"/>
    <map:transform type="xslt" src="{stylesheet}">
	<map:parameter multiple="true"  value="{xsltparams}"/>
    </map:transform>
 </map:include>

the first would make an array like:

$xsltparams = array("param1" => "somevalue", "param2" => "someothervalue");

and the sitemap would translate that as if it was written as

<map:parameter name="param1" value="somevalue"/>
<map:parameter name="param2" value="someothervalue"/>

Would that help?

chregu

> 
> I guess i could take them right in stylesheet using php:functionString,
> but dunno if plugin instance acessable there.
> 

-- 
christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71
http://www.bitflux.ch | [email protected] |  GPG 0x5CE1DECB
-- 
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms