RE: MS-FO-LC1-084: fn:lang() function signature

Hello,

> This was discussed at the WG meeting on 9/16/2003 and it was decided
> that this function was not useful enough to warrant adding another
> signature for it.
> 
> This also covers a comment from Oracle on 6/30/2002 with title
> ORA-FO-LANG_ANYNODE.

Recently I had a use case where an explicit node parameter to the lang
function seems to be essentially. So I also suggest to add a version with
the signature fn:lang($testlang as xs:string, $srcval as node?)

Here's my use case:
The XML input document declares in its root element a language by using
the xml:lang attribute. A stylesheet that generates additional text in
the formatted result has to take care of that.

For this reason the stylesheet uses a special "vocable table" that contains
the correct terms for all supported languages (this table could be embedded 
within the stylesheet (1.0 compatible), or as a temporary tree in the contents
of a variable, or it could be in an external document, whatever ...)

Its outline looks like this:
<i18n lang="en">
   <toc>Table of Contents</toc>
   <page>Page</page>
   ...
</i18n>
<i18n lang="de">
   <toc>Inhaltsverzeichnis</toc>
   <page>Seite</page>
   ...
</i18n>
... etc

The requirement is to define a variable (depending on the declared language)
that contains the relevant i18n node only and can therefore be used like this
<xsl:value-of select="$i18n/toc" />
everywhere in the stylesheet.

To declare this as a global variable in the stylesheet, the lang() function
without a node parameter doesn't help. By passing a node this could be
achieved by

<xsl:variable name="i18n" select="$terms[lang(@lang, $root)]" />
($terms contains my vocable table outlined above, $root is the root element)

If overlooked a solution with a simple lang(@lang) call I would be happy
to hear about that. Otherwise I hope the WG will consider my example as
a strong argument in favour of the suggested change.

Regards,
Oliver Becker


/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/

Received on Wednesday, 24 September 2003 06:25:02 UTC