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

It's a bit convoluted but I think you can replace

<xsl:variable name="i18n" select="$terms[lang(@lang, $root)]" />

with

<xsl:variable name="i18n" 
select="$terms[some $l in @lang satisfies $root[lang($l)]]" />


Michael Kay

> -----Original Message-----
> From: Oliver Becker [mailto:obecker@informatik.hu-berlin.de] 
> Sent: 24 September 2003 11:25
> To: public-qt-comments@w3.org
> Subject: 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 10:52:46 UTC