Connecting Tech Pros Worldwide Forums | Help | Site Map

Prohibited nesting questions

Harlan Messinger
Guest
 
Posts: n/a
#1: Jul 20 '05
I just read the note under the XHTML spec
(http://www.w3.org/TR/xhtml1/#h-4.9) that explains how XML DTD
notation doesn't provided for the exclusion of elements from
containment by the element being defined. For example, there is no way
to indicate that an <a> element can't contain another one.

I see that the strict HTML DTD shows

-(A)

in the definition of the <a> element. But AFAIK this means that an
anchor can't *directly* contain another one, and it doesn't cover a
situation like (attributes omitted)

<a>some <i>italicized <a>text</a> goes </i>here</a>

I looked for a note in the HTML spec that would correspond with the
one in the XHTML notes indicating that the above code isn't
acceptable, but didn't find one. Can anyone explain the particulars?

By the way, in the XHTML notes, only a few specific prohibitions are
noted (http://www.w3.org/TR/xhtml1/#prohibitions), but these don't
include nested <i>. What, in either XHTML or HTML, prevents an <i>
nested inside another one? Or am I wrong that such nesting is
prohibited--but in that case, what is the meaning of nested <i>?

--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ๔ter le premier point de mon adresse de courriel.

Steve Pugh
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Prohibited nesting questions


Harlan Messinger <hmessinger.removethis@comcast.net> wrote:
[color=blue]
>By the way, in the XHTML notes, only a few specific prohibitions are
>noted (http://www.w3.org/TR/xhtml1/#prohibitions), but these don't
>include nested <i>. What, in either XHTML or HTML, prevents an <i>
>nested inside another one? Or am I wrong that such nesting is
>prohibited--but in that case, what is the meaning of nested <i>?[/color]

Nested <i> are permitted. It has no meaning, just as <i> doesn't
really have any meaning either.

(Though as many cases of italics are false italics created by the
user's computer manipulating a basic font rather than by using a
designed italics font, the horrible possiblity exists that nested <i>
could lead to raelly ugly extra-slanted false italics.)

With CSS you can of course use
i {font-style: italic;}
i i {font-style: normal;}
which complies with normal typography and makes life easier for
authors, style guides and content management systems. (e.g. text in a
foreign language and names of vessels are simply marked up using <i>,
even when one is contained within the other).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <steve@pugh.net> <http://steve.pugh.net/>
Jukka K. Korpela
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Prohibited nesting questions


Harlan Messinger <hmessinger.removethis@comcast.net> wrote:
[color=blue]
> I just read the note under the XHTML spec
> (http://www.w3.org/TR/xhtml1/#h-4.9) that explains how XML DTD
> notation doesn't provided for the exclusion of elements from
> containment by the element being defined.[/color]

Quite right. This puts the widespread cargo cult slogan
"XHTML is more rigorous than tag-soup HTML" into perspective.
[color=blue]
> For example, there is no
> way to indicate that an <a> element can't contain another one.[/color]

Actually, the DTD could be rewritten to disallow <a> elements within
<a> elements. But it would mean lots of rules.
[color=blue]
> I see that the strict HTML DTD shows
>
> -(A)
>
> in the definition of the <a> element.[/color]

Ditto in other HTML DTDs.
[color=blue]
> But AFAIK this means that an
> anchor can't *directly* contain another one, and it doesn't cover a
> situation like (attributes omitted)
>
> <a>some <i>italicized <a>text</a> goes </i>here</a>[/color]

No, it forbids that too. A validator will report an error.

The meaning of -(A) in a DTD is defined, in the SGML standard, in a
manner that excludes any occurrence of A in the content, either
directly as a subelement, or as a subelement of subelement etc.
[color=blue]
> I looked for a note in the HTML spec that would correspond with
> the one in the XHTML notes indicating that the above code isn't
> acceptable, but didn't find one. Can anyone explain the
> particulars?[/color]

In principle there is no need to say in prose something that is said in
a formalized manner in a DTD. In practice, few people read DTDs, and
even fewer understand them.
[color=blue]
> By the way, in the XHTML notes, only a few specific prohibitions
> are noted (http://www.w3.org/TR/xhtml1/#prohibitions), but these
> don't include nested <i>. What, in either XHTML or HTML, prevents
> an <i> nested inside another one?[/color]

Nothing.
[color=blue]
> Or am I wrong that such nesting
> is prohibited--but in that case, what is the meaning of nested <i>?[/color]

The same as unnested. Physical markup like <i> is idempotent. Not all
physical markup is; for example <big><big>...</big></big> could be
argued as indicating bigger than big (the specification is vague), and
that's how browsers treat it. A case could be made for
<b><b>...</b></b> too, since bolding could be viewed as relative, but
it seems that browsers don't behave that way - they treat <b> as
correspong to CSS declaration font-weight: bold even in situations
where more than one degree of bolding exists (which depends on the font
and on the browser etc.).

The semantics of nested markup is generally vaguely defined, or left
completely undefined, in HTML specs. The general idea is probably that
nested emphasis _should_ be honored, but browsers really don't bother.
Consider <em>...<em>...</em>...</em>. A good implementation, if it uses
italics, would switch to upright style for the inner <em> element or
otherwise indicate it as different from the surrounding text. But to
browsers, <em> is just a synonym for <i>, though kept as a separate
symbol so that you can _style_ it differently. Ooops, I seem to have
revealed a secret that we Purists have tried to protect from the masses
who would misunderstand it... :-)

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Chris Morris
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Prohibited nesting questions


"Jukka K. Korpela" <jkorpela@cs.tut.fi> writes:[color=blue]
> Harlan Messinger <hmessinger.removethis@comcast.net> wrote:[color=green]
> > Or am I wrong that such nesting
> > is prohibited--but in that case, what is the meaning of nested <i>?[/color]
>
> The same as unnested. Physical markup like <i> is idempotent. Not all
> physical markup is; for example <big><big>...</big></big> could be
> argued as indicating bigger than big (the specification is vague), and
> that's how browsers treat it. A case could be made for
> <b><b>...</b></b> too, since bolding could be viewed as relative, but
> it seems that browsers don't behave that way - they treat <b> as
> correspong to CSS declaration font-weight: bold even in situations
> where more than one degree of bolding exists (which depends on the font
> and on the browser etc.).[/color]

Though
b {
font-weight: bolder;
}

would be straightforward enough to put into an author stylesheet.
Unfortunately few browsers implement the whole range well, most seem
to only do
100-500 = 400
600-800 = 700
900 = 900 or 700 or mangled [1]

[1] Someone else's IE installation. It looked absolutely fine on
mine. Font problems of some sort, but I wasn't able to go to see the
browser first-hand to confirm.

--
Chris
Alan J. Flavell
Guest
 
Posts: n/a
#5: Jul 20 '05

re: Prohibited nesting questions


On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
[color=blue]
> The same as unnested. Physical markup like <i> is idempotent.[/color]

However, there's nothing stopping you from defining a different
style for "i i" than for "i" in CSS, if you are so inclined. And the
same for your "b b" example too.

What it would actually _mean_ is of course a different matter, as you
said.
Neal
Guest
 
Posts: n/a
#6: Jul 20 '05

re: Prohibited nesting questions


On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <flavell@ph.gla.ac.uk>
wrote:
[color=blue]
> On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
>[color=green]
>> The same as unnested. Physical markup like <i> is idempotent.[/color]
>
> However, there's nothing stopping you from defining a different
> style for "i i" than for "i" in CSS, if you are so inclined. And the
> same for your "b b" example too.
>
> What it would actually _mean_ is of course a different matter, as you
> said.[/color]


I did once see a style sheet with

em {
font-style: italic;
}
em em {
font-style: normal;
}

in order to allow for double-level emphasis, but I never saw an example of
this on the page in question.
Harlan Messinger
Guest
 
Posts: n/a
#7: Jul 20 '05

re: Prohibited nesting questions



"Neal" <neal413@spamrcn.com> wrote in message
news:opr3iwfpa4dvhyks@news.rcn.com...[color=blue]
> On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <flavell@ph.gla.ac.uk>
> wrote:
>[color=green]
> > On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
> >[color=darkred]
> >> The same as unnested. Physical markup like <i> is idempotent.[/color]
> >
> > However, there's nothing stopping you from defining a different
> > style for "i i" than for "i" in CSS, if you are so inclined. And the
> > same for your "b b" example too.
> >
> > What it would actually _mean_ is of course a different matter, as you
> > said.[/color]
>
>
> I did once see a style sheet with
>
> em {
> font-style: italic;
> }
> em em {
> font-style: normal;
> }
>
> in order to allow for double-level emphasis, but I never saw an example of
> this on the page in question.[/color]

That makes sense. I've done something similar, when I've had a class for
which I specified italic printing:

.myClass { font-style: italic; }
.myClass em { font-style: normal; }

Andrew Glasgow
Guest
 
Posts: n/a
#8: Jul 20 '05

re: Prohibited nesting questions


In article <opr3iwfpa4dvhyks@news.rcn.com>, Neal <neal413@spamrcn.com>
wrote:
[color=blue]
> On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <flavell@ph.gla.ac.uk>
> wrote:
>[color=green]
> > On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
> >[color=darkred]
> >> The same as unnested. Physical markup like <i> is idempotent.[/color]
> >
> > However, there's nothing stopping you from defining a different
> > style for "i i" than for "i" in CSS, if you are so inclined. And the
> > same for your "b b" example too.
> >
> > What it would actually _mean_ is of course a different matter, as you
> > said.[/color]
>
>
> I did once see a style sheet with
>
> em {
> font-style: italic;
> }
> em em {
> font-style: normal;
> }
>
> in order to allow for double-level emphasis, but I never saw an example of
> this on the page in question.[/color]

The question would be, what would happen to text within three levels of
<em></em>?

--
| Andrew Glasgow <amg39(at)cornell.edu> |
|"I am astounded ... at the wonderful power you have developed -- and |
|terrified at the thought that so much hideous and bad music may be put on |
|record forever." -- Arthur Sullivan, 1888, upon viewing Edison's phonograph|
Jukka K. Korpela
Guest
 
Posts: n/a
#9: Jul 20 '05

re: Prohibited nesting questions


Andrew Glasgow <amg39@cornell.edu> wrote:
[color=blue][color=green]
>> I did once see a style sheet with
>>
>> em {
>> font-style: italic; }
>> em em {
>> font-style: normal; }
>>
>> in order to allow for double-level emphasis, but I never saw an
>> example of this on the page in question.[/color]
>
> The question would be, what would happen to text within three
> levels of <em></em>?[/color]

The innermost element would take the style defined for "em em",
i.e. font-style: normal. And this in turn could be prevented by
replacing the selector "em" in the first rule by the selector list
"em em em". And so on. It's quite manageable in an author style sheet.
But in practice you would hardly use such nesting anyway.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Closed Thread