You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by richard work <ri...@dynasty-solutions.co.uk> on 2003/03/16 02:39:38 UTC

problems with PARAM and xsl:param

Hi,

Excuse me if my stupidity shows but I have been trying to solve this problem
for the last 5 hours. I have a very simple cgi script that calls testXSLT
with " -PARAM Resort Blackpool".
Within the xsl file I have:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="Resort" select="'none'"/>
...
<xsl:template match="/">
...
<xsl:text>List of hotels in the operator's catalogue</xsl:text><br/>
<xsl:text>passed in parameter :- </xsl:text>
<xsl:value-of select="$Resort"/>
<xsl:text> so there</xsl:text>
...

The problem, $Resort never gets set to "Blackpool". In fact as the code is
laid out I don't even get "none" as the output. If I move the <xsl:param
../> into the "/" template then I do get "none" but I still don't get
"Blackpool".

How do I get -PARAM to work please!

			Regards, Richard


RE: problems with PARAM and xsl:param

Posted by richard work <ri...@dynasty-solutions.co.uk>.
I am an idiot of the first water! I am calling testXSLT from a perl script
so I have to escape the quotes in the line, DOH! Thank you for your help.

			Regards, Richard


-----Original Message-----
From: richard work [mailto:richard@dynasty-solutions.co.uk]
Sent: 16 March 2003 10:12
To: Berin Lautenbach
Cc: xalan-c-users@xml.apache.org
Subject: RE: problems with PARAM and xsl:param



Hi Berin,

This does not work as testXSLT throws up an error with the quotes. I have
tried:

... -PARAM Resort Blackpool     - testXSLT runs but Blackpool does not get
passed in
... -PARAM Resort 'Blackpool'   - testXSLT runs but Blackpool does not get
passed in
... -PARAM Resort "Blackpool"   - testXSLT fails (Missing operator before
'Blackpool')
... -PARAM Resort "'Blackpool'" - testXSLT fails               "

-----Original Message-----
From: Berin Lautenbach [mailto:berin@ozemail.com.au]
Sent: 16 March 2003 09:42
Cc: xalan-c-users@xml.apache.org
Subject: Re: problems with PARAM and xsl:param


Richard,

Not intuitive until you think in the same way as you would in the style
sheet :>.

Try using the command line

... -PARAM Resort "'Blackpool'"

(I think there is some stuff in the archives around this.)

Cheers,
	Berin

richard work wrote:
> Hi,
>
> Excuse me if my stupidity shows but I have been trying to solve this
problem
> for the last 5 hours. I have a very simple cgi script that calls testXSLT
> with " -PARAM Resort Blackpool".
> Within the xsl file I have:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html"/>
> <xsl:param name="Resort" select="'none'"/>
> ...
> <xsl:template match="/">
> ...
> <xsl:text>List of hotels in the operator's catalogue</xsl:text><br/>
> <xsl:text>passed in parameter :- </xsl:text>
> <xsl:value-of select="$Resort"/>
> <xsl:text> so there</xsl:text>
> ...
>
> The problem, $Resort never gets set to "Blackpool". In fact as the code is
> laid out I don't even get "none" as the output. If I move the <xsl:param
> ../> into the "/" template then I do get "none" but I still don't get
> "Blackpool".
>
> How do I get -PARAM to work please!
>
> 			Regards, Richard
>
>


RE: problems with PARAM and xsl:param

Posted by richard work <ri...@dynasty-solutions.co.uk>.
Hi Berin,

This does not work as testXSLT throws up an error with the quotes. I have
tried:

... -PARAM Resort Blackpool     - testXSLT runs but Blackpool does not get
passed in
... -PARAM Resort 'Blackpool'   - testXSLT runs but Blackpool does not get
passed in
... -PARAM Resort "Blackpool"   - testXSLT fails (Missing operator before
'Blackpool')
... -PARAM Resort "'Blackpool'" - testXSLT fails               "

-----Original Message-----
From: Berin Lautenbach [mailto:berin@ozemail.com.au]
Sent: 16 March 2003 09:42
Cc: xalan-c-users@xml.apache.org
Subject: Re: problems with PARAM and xsl:param


Richard,

Not intuitive until you think in the same way as you would in the style
sheet :>.

Try using the command line

... -PARAM Resort "'Blackpool'"

(I think there is some stuff in the archives around this.)

Cheers,
	Berin

richard work wrote:
> Hi,
>
> Excuse me if my stupidity shows but I have been trying to solve this
problem
> for the last 5 hours. I have a very simple cgi script that calls testXSLT
> with " -PARAM Resort Blackpool".
> Within the xsl file I have:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html"/>
> <xsl:param name="Resort" select="'none'"/>
> ...
> <xsl:template match="/">
> ...
> <xsl:text>List of hotels in the operator's catalogue</xsl:text><br/>
> <xsl:text>passed in parameter :- </xsl:text>
> <xsl:value-of select="$Resort"/>
> <xsl:text> so there</xsl:text>
> ...
>
> The problem, $Resort never gets set to "Blackpool". In fact as the code is
> laid out I don't even get "none" as the output. If I move the <xsl:param
> ../> into the "/" template then I do get "none" but I still don't get
> "Blackpool".
>
> How do I get -PARAM to work please!
>
> 			Regards, Richard
>
>


RE: problems with PARAM and xsl:param

Posted by richard work <ri...@dynasty-solutions.co.uk>.
Perhaps the documentation needs more examples so that us simple people can
understand them! I actually did find the solutions by myself - but messed it
up by running it from a perl script.

-----Original Message-----
From: Per Jessen [mailto:per@computer.org]
Sent: 16 March 2003 19:58
To: xalan-c-users@xml.apache.org
Subject: Re: problems with PARAM and xsl:param


On Sun, 16 Mar 2003 20:42:22 +1100, Berin Lautenbach wrote:

>Not intuitive until you think in the same way as you would in the style
>sheet :>.
>Try using the command line
>.. -PARAM Resort "'Blackpool'"
>(I think there is some stuff in the archives around this.)

Not intuitive unless you read the documentation first :-) - I've been
through the same problem, but putting things in single qoutes only
occurred to me after reading that the value of parameter to be set
is read as an /expression/.  (when calling setStylesheetParam()).

Mind you, it /did/ take a while before I got that far.

/Per

regards,
Per Jessen, Zurich
http://www.enidan.com - home of the J1 serial console.



Re: problems with PARAM and xsl:param

Posted by Per Jessen <pe...@computer.org>.
On Sun, 16 Mar 2003 20:42:22 +1100, Berin Lautenbach wrote:

>Not intuitive until you think in the same way as you would in the style 
>sheet :>.
>Try using the command line
>.. -PARAM Resort "'Blackpool'"
>(I think there is some stuff in the archives around this.)

Not intuitive unless you read the documentation first :-) - I've been
through the same problem, but putting things in single qoutes only
occurred to me after reading that the value of parameter to be set
is read as an /expression/.  (when calling setStylesheetParam()).

Mind you, it /did/ take a while before I got that far.

/Per

regards,
Per Jessen, Zurich
http://www.enidan.com - home of the J1 serial console.



Re: problems with PARAM and xsl:param

Posted by Berin Lautenbach <be...@ozemail.com.au>.
Richard,

Not intuitive until you think in the same way as you would in the style 
sheet :>.

Try using the command line

... -PARAM Resort "'Blackpool'"

(I think there is some stuff in the archives around this.)

Cheers,
	Berin

richard work wrote:
> Hi,
> 
> Excuse me if my stupidity shows but I have been trying to solve this problem
> for the last 5 hours. I have a very simple cgi script that calls testXSLT
> with " -PARAM Resort Blackpool".
> Within the xsl file I have:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="html"/>
> <xsl:param name="Resort" select="'none'"/>
> ...
> <xsl:template match="/">
> ...
> <xsl:text>List of hotels in the operator's catalogue</xsl:text><br/>
> <xsl:text>passed in parameter :- </xsl:text>
> <xsl:value-of select="$Resort"/>
> <xsl:text> so there</xsl:text>
> ...
> 
> The problem, $Resort never gets set to "Blackpool". In fact as the code is
> laid out I don't even get "none" as the output. If I move the <xsl:param
> ../> into the "/" template then I do get "none" but I still don't get
> "Blackpool".
> 
> How do I get -PARAM to work please!
> 
> 			Regards, Richard
> 
>