Re: [xslt] How to use command line variables?



Le 14/08/01 23:55:06, ben a écrit :
> I have a problem in setting variables in the command line of xsltproc. I
> think it's a problem in the XSL stylesheet I use, but actually I don't
> know. With XT and Xalan it works fine.
> 
> The problem is that when using:
> 
> xsltproc --param my-global-variable the-value file.xsl file.xml >
> out.xml
> 
> with something like this in the file.xsl:
> 
> <xsl:value-of select="$my-global-variable"/>
> 
> The output isn't what is set in the command line (in fact it's empty).

Isn't it a FAQ?
The values are XPath expressions. If you want to set a string value, you
have to use «--param my-global-param "'the-value'"» for example, or
«--param my-global-param \"the-value\"»

Also, be sure to have a top-level <xsl:param name="my-global-variable"/> in
your stylesheet (they are commented out in your example)

Tom.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]