Re: About XHTML 2.0

Sjoerd Visscher wrote:
>> I also haven't heard any response to the issue that it creates
>> problems with XPath and CSS selectors.
> 
> OK, show me the XPath that selects the content between 2 separators.

If CSS isn’t a valid argument for changing markup (which I happen to 
agree with :)), why should the incapability of XPath be a good argument?

But ok, I take you up on that challenge!

(However, I’ll cheat (a little) and use XPath 2.0 :))

    separator[$i]/following-sibling::* intersect
    separator[$i+1]/preceding-sibling::*

Or, something which also works when either of the separators doesn’t 
exist (0 = before first separator, 1 = between first and second 
separator, ..., n = after last separator):

    * except separator[$i]/preceding-sibling::* except
    separator[$i+1]/following-sibling::* except separator

Using the DOM it’s pretty easy too:

    var blockno = 2;      // which block inbetween separators you want
    var list = new Array();
    for (var i=0; i<elm.childNodes.length || blockno < 0; i++) {
       if (elm.childNodes[i].nodeName == 'separator') blockno--;
       else if (blockno == 0) list.push(elm.childNodes[j]);
    }

Hardly any longer than most other Javascript functions to recreate an 
XPath query using the DOM functions.

As far as CSS is concerned, you can select the elements following a 
<separator/> element by using the ‘~’ selector (or the element following 
it immediately using ‘+’). So within its common limitations, CSS is 
capable of styling sections around and inbetween separators as well.

So, let’s get this straight, you’re to argueing to change a nice general 
markup element which represents exactly what it does into something with 
a stricter meaning (e.g. a <perspective> tag which only applies to one 
<selector/> use case)...

...just because of a limitation in a selector language (XPath 1.0)?


~Grauw

-- 
Ushiko-san! Kimi wa doushite, Ushiko-san!!

Received on Tuesday, 24 May 2005 00:35:43 UTC