W3C home > Mailing lists > Public > public-multilingualweb-lt@w3.org > June 2012

Re: ISSUE 16: parameters for rules

From: Jirka Kosek <jirka@kosek.cz>
Date: Wed, 06 Jun 2012 09:13:50 +0200
Message-ID: <4FCF032E.6030805@kosek.cz>
To: Yves Savourel <ysavourel@enlaso.com>
CC: public-multilingualweb-lt@w3.org
On 4.6.2012 6:51, Yves Savourel wrote:

> I assume we would have also some method to specify default values as well.
> 
> <its:rules version="2.0" xmlns:its="http://www.w3.org/2005/11/its">
>  <its:param name="LCID">1033</its:param>
>  <its:translateRule selector="/doc" translate='no'/>
>  <its:translateRule selector="//text[@lcid='$LCID']" translate='yes'/>
> </its>
> 
> A few notes:
> 
> -- While the implementation itself is relatively easy (just a substitution of the variables by the values before applying the rules), there is a burden of capturing the parameters values and passing them to the processor that may be trickier than doing the substitution. It's easy to do with a command-line tools, but probably more involved with UI-based or Web-based tools.

Hi,

if we want to include this into ITS 2.0 we must fit syntax and
processing into XPath model. This would mean that variable replacement
wouldn't be performed as a preprocessing step before evaluating XPath,
but ITS variables will be true XPath variables. So your example should
read as:

 <its:translateRule selector="//text[@lcid=$LCID]" translate='yes'/>

(Note missing apostrophes around $LCID)

Please note that XPath 1.0 specification allow variable references
(http://www.w3.org/TR/xpath/#NT-VariableReference) and variable bindings
are part of evaluation context.

Also its:param should be mandatory not only to provide default value,
but also to declare all variables that can be legaly referenced from
XPath expressions in rules.

Implementation will be very easy for XSLT based toolchains. I'm not sure
if all pure XPath libraries are able to bind parameters before evaluation.

				Jirka

-- 
------------------------------------------------------------------
  Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
------------------------------------------------------------------
       Professional XML consulting and training services
  DocBook customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
------------------------------------------------------------------


Received on Wednesday, 6 June 2012 07:14:26 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 9 June 2013 00:24:56 UTC