cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: xsp, xsl-vaiables and xsl-attributes
Date Wed, 28 Jun 2000 09:52:01 GMT
>Hans-Guenter Stein wrote:
> >
> > Why can't I compute <xsp:expr> inside an <xsl:variable>?
> >
> > i.e.
> > if I try:
> > <xsl:variable name="myVariable"><xsp:expr>0+1</xsp:expr></xsl:variable>
> >
> > $myVariable will hold "0+1" instead of 1.
> >
> > if I try:
> > <myContent>
> > <xsl:attribute
> > name="myAttribute"><xsp:expr>0+1</xsp:expr></xsl:attribute>
> > </myContent>
> >
> > the processor throws something like 'can't have <xsp:expr> inside
> > <xsl:attribute>
> >
> > ----
> > In fact, I want to do the following (which appears to be a very basic
> > problem):
> >
> > my xml looks like:
> > <page>
> >  <pageContent language="en">
> >   This is English
> >  </pageContent>
> >  <pageContent language="ge">
> >   This is German
> >  </pageContent>
> > </page>
> >
> > in the xsp, I want to analyse the page-request-paramters with the
> > cocoon-lib 'request' by using:
> > <request:get-parameter-values name="language"/>
> > (the page request looks like: "http://myServer.com/myXML?language=en")
> >
> > now I want to write a template for <pageContent>, that copies the
> > correct language version into the output, such that, in above case, the
> > output should be exactly:
> > <page>
> >  <pageContent language="en">
> >   This is English
> >  </pageContent>
> > </page>
> >


It is possible to mix XSL with Java or XSP in a stylesheet. If you do this, 
you must specify the <xsp:page> tag either in the stylesheet (so that e.g. 
it replaces <page> by <xsp:page>) or in the source document. However, the 
XSP or Java code is only executed after the stylesheet has been processed. 
No XSP or Java code is executed by the stylesheet processor (except in the 
case of XSL function calls, but there is no implementation-independent 
standard for this yet.) A lot of people get tripped up by this.

For a simple language selector, with your setup, you should need no Java or 
XSP code at all. Just use <xsl:param> and <xsl:apply-templates> with an 
embedded parameter.


________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Mime
View raw message