473,385 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Prohibited nesting questions

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.
Jul 20 '05 #1
8 1733
Harlan Messinger <hm*******************@comcast.net> wrote:
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>?


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 <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #2
Harlan Messinger <hm*******************@comcast.net> wrote:
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.
Quite right. This puts the widespread cargo cult slogan
"XHTML is more rigorous than tag-soup HTML" into perspective.
For example, there is no
way to indicate that an <a> element can't contain another one.
Actually, the DTD could be rewritten to disallow <a> elements within
<a> elements. But it would mean lots of rules.
I see that the strict HTML DTD shows

-(A)

in the definition of the <a> element.
Ditto in other HTML DTDs.
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>
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.
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?
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.
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?
Nothing.
Or am I wrong that such nesting
is prohibited--but in that case, what is the meaning of nested <i>?


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

Jul 20 '05 #3
"Jukka K. Korpela" <jk******@cs.tut.fi> writes:
Harlan Messinger <hm*******************@comcast.net> wrote:
Or am I wrong that such nesting
is prohibited--but in that case, what is the meaning of nested <i>?


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.).


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
Jul 20 '05 #4
On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
The same as unnested. Physical markup like <i> is idempotent.


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.
Jul 20 '05 #5
On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <fl*****@ph.gla.ac.uk>
wrote:
On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
The same as unnested. Physical markup like <i> is idempotent.


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.

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.
Jul 20 '05 #6

"Neal" <ne*****@spamrcn.com> wrote in message
news:op**************@news.rcn.com...
On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <fl*****@ph.gla.ac.uk>
wrote:
On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
The same as unnested. Physical markup like <i> is idempotent.


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.

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.


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; }

Jul 20 '05 #7
In article <op**************@news.rcn.com>, Neal <ne*****@spamrcn.com>
wrote:
On Tue, 17 Feb 2004 14:06:10 +0000, Alan J. Flavell <fl*****@ph.gla.ac.uk>
wrote:
On Tue, 17 Feb 2004, Jukka K. Korpela wrote:
The same as unnested. Physical markup like <i> is idempotent.


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.

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.


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|
Jul 20 '05 #8
Andrew Glasgow <am***@cornell.edu> wrote:
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.


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


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

Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Hertz | last post by:
I have hundreds of samples of XML documents on my harddisc. But all of them lack the one or another feature of XML. Some XML documents have no attributes some others are rather flat (nesting...
0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
8
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
8
by: Hardrock | last post by:
I encountered some difficulty in implementing dynamic loop nesting. I.e. the number of nesting in a for(...) loop is determined at run time. For example void f(int n) { For(i=0; i<=K; i++)...
6
by: Neal | last post by:
Hi All, I used an article on XSLT and XML and creating a TOC written on the MSDN CodeCorner. ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/dncodecorn/html/corner042699.htm However, it did'nt...
4
by: kl.vanw | last post by:
I would like to count the nesting level in template classes. How can I make the following work? #include <assert.h> template <class T> class A { public: A() { // what goes here?
6
by: stephen.cunliffe | last post by:
Hi, I'm looking for opinion/facts/arguments on the correct nesting of UL, OL, & LI elements. For example, this is what I want (unordered list): * Item 1 * Item 2 * Item 3
17
by: henry | last post by:
Folks Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit of php code in the middle: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.