Next in thread → Next in month →

Re: [docbook-apps] How to generate PHP code in a XSL customization layer

From
Frans Englich <>
Date
2005-03-08T17:19:51+00:00
ID
Thread
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
Next in thread → Next in month →