This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] How to generate PHP code in a XSL customization layer
On Tuesday 08 March 2005 13:28, Roberto Gianassi wrote:
[...]
> When profile.lang is equal to "it" I would like to generate something
> equivalent to this:
>
> <xsl:processing-instruction name="php">
> include ('../php/filename_it.php');
> </xsl:processing-instruction>
>
> while profile.lang is equal to "en" this:
>
> <xsl:processing-instruction name="php">
> include ('../php/filename_en.php');
> </xsl:processing-instruction>
It's also a matter of xslt programming, AFAICT :) I'm no expert but this is
from what I know:
"profile.lang" is a parameter, which means it's referenced like a variable in
XPath statements: $profile.lang. In your case, you can write the file
inclusion in a generic way like this:
<xsl:processing-instruction name="php">
include ('../php/filename_<xsl:value-of select="$profile.lang"/>.php');
</xsl:processing-instruction>
It works for any language, and is less verbose than a xsl:choose clause,
although that'll work too, AFAIK.
But I can very well be wrong,
Frans