Re: [xsl] global language parameter

Subject: Re: [xsl] global language parameter
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Sat, 13 Feb 2010 18:06:40 +0100
Charles Muller wrote:

I'm taking my first stab at making a global parameter, through which I'd like to set font attributes for character sets of different languages. I'm using TEI-P5 with XSL 2, and I want my parameter to work with xml:lang.

It tried writing this way:

<xsl:template name="languageWrap">
   <xsl:param name="contents">

I am not sure I understand what you want to achieve without seeing the input XML and the output you want to create but your text above says "making a global" parameter while here you are defining a parameter that is local to your template named "languageWrap".

A global parameter is defined as a child of the xsl:stylesheet element, not inside of a template, and is used to allow to pass in a value to the transformation that can be changed each time the transformation is run.

     <xsl:when test="@xml:lang='sa'">

You might want to use the 'lang' function e.g.
<xsl:when test="lang('sa')">
as that way you could check for the language defined on the context node or an ancestor while your check with @xml:lang only checks the context node.

       <span style="font-family: 'Times Ext Roman'">
         <xsl:copy-of select="$contents"/>
    <xsl:when test="@xml:lang='zh'">
       <span style="font-family: Mincho,MingLiU, Batang, Simsun">
         <xsl:copy-of select="$contents"/>
    <xsl:when test="@xml:lang='ko'">
       <span style="font-family: Batang, BatangChe">
         <xsl:copy-of select="$contents"/>
       <xsl:copy-of select="$contents"/>

But nothing happens in the generated HTML--there are no <span> tags generated at all in the document. Any suggestions as to what I should be looking for here?

Show us some context where you call the above template and where we can see what the context node is and which xml:lang value it has.


	Martin Honnen

Current Thread