RE: ISSUE 16: parameters for rules

Thanks for the pointers Jirka.

So it seems we don't have much to do on the ITS side since XPath does already supports variables. Except if we want to allow them outside XPath expressions.

In 1.0 there aren't many attributes that are not XPath values. There is termInfoRef, which is a URI. But do we want to allow variables in URI? (termInforef="http:// http://$LANG.wikipedia.org/wiki/XPath")?
And obviously there are the 2.0 data categories that may have a few non-XPath values.

-ys


-----Original Message-----
From: Jirka Kosek [mailto:jirka@kosek.cz] 
Sent: Wednesday, June 06, 2012 9:14 AM
To: Yves Savourel
Cc: public-multilingualweb-lt@w3.org
Subject: Re: ISSUE 16: parameters for rules

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 Friday, 8 June 2012 06:58:54 UTC