W3C home > Mailing lists > Public > www-style@w3.org > November 2013

Re: [selectors4] Proposal for extending Selectors Level 4 with possibility to select attributes

From: Jirka Kosek <jirka@kosek.cz>
Date: Sat, 09 Nov 2013 13:57:33 +0100
Message-ID: <527E313D.1010906@kosek.cz>
To: Simon Sapin <simon.sapin@exyr.org>
CC: www-style list <www-style@w3.org>
On 9.11.2013 8:23, Simon Sapin wrote:
> Could ITS specify the attribute name separately?
> 
> <its:translateRule selector="*" attribute="title" translate="yes"/>

That wouldn't work for many reasons.

First, in selector you can use any query language, the default is XPath.
As other query languages then Selectors can directly address attributes
it would mean that attribute attribute will be there only for Selectors
and it would introduce situation when for all other query languages
implementations will be forced to support two syntaxes for accessing
attributes and existing implementations have to bee changed, e.g. in XPath:

<its:translateRule selector="//a" attribute="title" translate="yes"/>
and
<its:translateRule selector="//a/@title" translate="yes"/>

Several ITS rules contain multiple selectors (see attributes ending with
*Pointer) and that would mean introducing additional attribute for each
such selector. For example suppose that you use custom data attribute
for storing localization notes:

<p data-note="The variable {{device}} has three possible values:
'printer', 'stacker' and 'stapler options'>The {{device}} has been
disabled.</p>

You can use locNotePointer to specify where localization note is
present. In XPath this would be:

<its:locNoteRule locNoteType="description"
                 selector="//*[@data-note]"
                 locNotePointer="@data-note">

With your approach you would have to add additional attribute
locNotePointerAttribute. Also how would you specify with Selectors that
context node is not changed in locNotePointer (there is no equivalent to
. in XPath)?

While with added support for choosing attribute nodes into Selectors,
this could be written very simply like:

<its:locNoteRule locNoteType="description"
                 selector="*[data-note]"
                 locNotePointer="@data-note">

or

<its:locNoteRule locNoteType="description"
                 selector="*[data-note]"
                 locNotePointer="::attr(data-note)">

Depending on syntax which will be used for attribute node selector.

Also ITS 2.0 is at Recommendation stage, and there are currently no
plans to work on a new version in a near future.


						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 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------


Received on Saturday, 9 November 2013 12:58:22 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 9 November 2013 12:58:23 UTC