W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

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

From: Oliver Becker <obecker@informatik.hu-berlin.de>
Date: Wed, 24 Sep 2003 12:25:00 +0200 (MEST)
Message-Id: <200309241025.h8OAP0U5027473@mail.informatik.hu-berlin.de>
To: public-qt-comments@w3.org


> 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

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>
<i18n lang="de">
... 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.

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC