Re: [xslt] xsl:param is not works..
- From: Matt Sergeant <matt sergeant org>
- To: "xslt gnome org" <xslt gnome org>
- Subject: Re: [xslt] xsl:param is not works..
- Date: Thu, 7 Jun 2001 02:47:41 +0100 (BST)
On Thu, 7 Jun 2001, [ks_c_5601-1987] ±èÀº¿µ wrote:
> Hello,
> I can't English,, Sorry.. But, I try.... ^^
> I have a problem..
> when I use libxslt-0.9.0, xsl:param is works, using xsltproc --param tag value..
> But,, libxslt-0.10.0 and 0.11.0 is not works.
>
> xsl :
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
> <xsl:output method="text"/>
>
> <xsl:param name="tag1"/>
> <xsl:param name="tag2"/>
>
> <xsl:template match="/">
> <xsl:if test="$tag1">
> tag1: <xsl:value-of select="$tag1"/>
> </xsl:if>
> <xsl:text> and </xsl:text>
> <xsl:if test="$tag2">
> tag2 : <xsl:value-of select="$tag2"/>
> <xsl:text> !! </xsl:text>
> </xsl:template>
>
> </xsl:stylesheet>
>
> xml:
> <doc/>
>
> xsltproc --param tag1 test1 --param tag2 test2 test.xsl test.xml
>
> result: and !!
Strangely libxslt expects the params in what I call "XPath" syntax. So if
you pass in an unquoted word, it treats it as a path to resolve. Since you
have no tag called test1 in your source XML, it resolves to blank.
Pass it in as a string, as follows:
xsltprox --param tag1 "'test1'" --param tag2 "'test2'" test.xsl test.xml
(it's a pain in the ass, I know, but I hope they don't revert the change
because AxKit now has work-arounds for this!)
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\\
// \\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]