Re: [CSS3] Generated and Replaced Content - Grouping (long, examples)

> And what about text nodes?

If you wanted to use text nodes as start points then you could have a 
special name for them. I'm not sure what you'd call it to remain 
consistent with the rest of CSS. It would have to distinguish itself 
from the set of possible tag names in XML. Would #text work?

> Where would they go?

The would fit into a set just like tag nodes.

> And could you select rows
> in groups of threes?

How about adding a skip argument instead of end tag:

	dl::(dt, 3) { ... }

Would give you the required behaviour.

	<dl>
		<::pseudo>
			<dt>...</dt>
			<dd>...</dd>
			<dt>...</dt>
			<dd>...</dd>
			<dt>...</dt>
			<dd>...</dd>
		</::pseudo>
		<::pseudo>
			<dt>...</dt>
			<dd>...</dd>
			<dt>...</dt>
			<dd>...</dd>
			<dt>...</dt>
			<dd>...</dd>
		</::pseudo>
	</dl>


> How about selecting images and the paragraph that
> follows them, but only if that paragraph has class caption?

I have a problem here. I think you could boil down each of the 
operations that you're making in English into arguments to ::sets(), 
but there would be many different arguments types: start-tag, end-tag, 
skip, exclude, etc. A solution would be named arguments:

	<body>
		<img src="ian.jpg">
		<p class="caption">Ian asking the question</p>
		<p>Ian asked a question at Town Hall yesterday.</p>
		<p>No one has yet to answer it.</p>
	</body>

	body::sets(img, include(img, p.caption)) {
		margin-left:2em;
	}

Where include is a parameter type that returns the set of no elements 
except those that match.

> And without
> selecting anything else in the section?

Again:

	<dl>
		<dt>...</dt>
		<dd>...</dd>
		<dt>...</dt>
		<dd>...</dd>
		<dt>...</dt>
		<dd>...</dd>
		<dt>...</dt>
		<dd>...</dd>
	</dl>

	dl::sets(dt, max(1)) { ... }

Would this be acceptable? Is there any other syntax to make it easier 
to express that you want to apply one type of filter out of the range 
of possible ones? What if you wanted to apply more than one filter?

	dl::sets(dt, end-tag(p) + skip(3))

?

	<body>
		<h1>Spec</h1>
		<p>Functions return a value.</p>
		<h1 class="note">Void</h1>
		<p>Some functions return the special type "void".</p>
		<p>Functions take arguments.</p>
	</body>

What if you wanted to start the set at the h1 with class note and get 
only the first succeeding paragraph?

	body::sets(h1.note, limit(1)) { ... }

Named arguments could be a solution in syntax terms, but I know nothing 
of how this might impact on implementations.

> If you can write an actual spec for this, I would love to see it. And
> would probably incorporate it into the CSS3 module. :-)

I do wonder if providing a quite large but powerful syntax for 
selecting arbitrary sets of tags from a level playing field is 
something that's best left out of CSS and grouping created by adding 
real document structure. Your example with the img and the caption is a 
good one that occurs in real HTML, but would any proposed solution ever 
be as elegant as just sticking a div tag around the required elements?

Ben


(q)	Ben Godfrey?
(a)	Web Developer and Designer
	See http://aftnn.org/ for details

Received on Thursday, 30 October 2003 16:04:59 UTC