cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sonny Sukumar" <ahimsad...@hotmail.com>
Subject Re: Re: [XSP] Java variables within tag attributes
Date Sat, 01 Nov 2003 20:29:24 GMT

Ok, more specifically, here's what I did...

1.) I had a mostly static XHTML doc in which I wanted to fill in a 2-3 
sections with dynamic content.  For each such section I embedded a 
<mysite:content replace-with="someGeneralContentName"/>

2.) I wrote a simple stylesheet like:

<xsl:stylesheet version="1.0">
  <xsl:param name="pageTitle" select="'Welcome to RedPouch.com'"/>

  <xsl:template match="mysite:content[@replace-with='pageTitle']">
    <cinclude:include src="{$pageTitle}"/>
  </xsl:template>

  <xsl:template match="@*|node()" priority="-1">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

As you can see, "pageTitle" is one instance of a general content name.

3.) In the sitemap you'd do something like:

...
<map:transform type="xslt" src="xsl/myStyleSheet.xsl">
  <map:parameter name="pageTitle" 
value="{request-param:someParamFromRequest"/>
</map:transform>
<map:transform type="cinclude"/>

That's about it. :-)

Sonny

>From: Jan Wielgus <list40@o2.pl>
>Reply-To: users@cocoon.apache.org
>To: users@cocoon.apache.org, ssukumar@ecologyfund.net
>Subject: Re: Re: [XSP] Java variables within tag attributes
>Date: Sat,  1 Nov 2003 21:20:50 +0100
>
>
> >Hi Jan,
> >
> >I did a similar thing by using by writing an XSLT stylesheet that
>declares
> >an xsl:param, passing the param from my sitemap using
>map:transform, and
> >having the XSLT stylesheet fill in the "src" attribute value for the
> ><cinclude>.  After that stage is done, you can pass it through the
> >"cinclude" transformer.
>
>Would you give me a little code-example, if possible?
>
>Jan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>

_________________________________________________________________
Want to check if your PC is virus-infected?  Get a FREE computer virus scan 
online from McAfee.    
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


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


Mime
View raw message