axr / specification

This is where we work on the specification for AXR
spec.axrproject.org
13 stars 0 forks source link

new splitter #93

Closed Mouvedia closed 11 years ago

Mouvedia commented 11 years ago

reminder: http://spec.axrproject.org/specification.html#n1.5.7

currently

//hss
.. element:nth(3) { }

//xml
<root>
   <element>
      <element>
      </element>
   </element>
   <element> //this one is selected
      <element>
      </element>
   </element>
   <element>
      <element>
      </element>
   </element>
</root>

new splitter

//hss
.. element/level:nth(3) { }

//xml
<root>
   <element>
      <element>
      </element>
   </element>
   <element>
      <element>
      </element>
   </element>
   <element> //this one would be selected
      <element> //and this one
      </element>
   </element>
</root>

In our example the level splitter takes the element collection and returns 2 collections (one for each degree of nesting).

advanced example

//hss
.. [element/level]:nth(3) { }

//xml
<root>
   <element>
      <element>
      </element>
   </element>
   <element>
      <element>
      </element>
   </element>
   <element> //this one would be selected
      <element> //this one isn't (it's the sixth in the collection)
      </element>
   </element>
</root>

Here the grouping brackets join the 2 collections spouted by the splitter into one.

PS: the name of the splitter is taken from the related property.

alternative name

/depth