By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,213 Members | 1,395 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,213 IT Pros & Developers. It's quick & easy.

Use of tags in header meta statements

P: n/a
In XHTML docs, I find that the W3 Validator raises an objection to my
headers without actually invalidating the document.

Not in <title></title>, but in meta name="abstract" and
name="description" I find that the inclusion of <q></q> is objected to
by the W3 validator. I'm told "< is first character of a delimiter,
but occurred as data."

I'm having trouble understanding this is significant. Is the "<"
definitely to be avoided (by using " for double quotes), or should
this alert simply be ignored because the document does validate OK?

I assume that whatever the answer is would apply as well to such
things as <span></span>

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #1
Share this Question
Share on Google+
18 Replies


P: n/a
Haines Brown <br****@hartford-hwp.com> writes:
In XHTML docs, I find that the W3 Validator raises an objection to
my headers without actually invalidating the document.

Not in <title></title>, but in meta name="abstract" and
name="description" I find that the inclusion of <q></q> is objected
to by the W3 validator. I'm told "< is first character of a
delimiter, but occurred as data."


I'm not sure if I'm getting what you're saying, but I assume you have
something like

<meta name="description" content="foo <q>bar</q> baz"/>.

This is not valid; you cannot have elements in an attribute value. In
addition, the less-than sign is not allowed literally in an attribute
value at all; it has be represented by &lt; or by a character
reference.

You will have to use quotation mark characters instead of the q
element, something like

<meta name="description" content='foo "bar" baz'>.

This lack of structure in attribute values is a recognized problem, and
it is proposed that in XHTML 2 the meta element will not be empty:
you will be able to write

<meta name="description">foo <q>bar</q> baz</meta>.

This is also one of the reasons <object>...</object> is superior to
<img alt="..."/>.

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #2

P: n/a
In article <m2************@hartford-hwp.com>, one of infinite monkeys
at the keyboard of Haines Brown <br****@hartford-hwp.com> wrote:
In XHTML docs, I find that the W3 Validator raises an objection to my
headers without actually invalidating the document.


I don't know what you mean by that. Please post a URL that demonstrates
what you're talking about.

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #3

P: n/a
Haines Brown <br****@hartford-hwp.com> writes:
Thanks. Understood. But I wonder, since <title>...</title> is a
container, how does one quote? I assume I can't use a quotation mark
because it is a reserved character, but could I use <q></q>? Or do
I have to:

<title>foo "bar" baz</title>
The character <"> is not reserved in this context; <title>foo "bar"
baz</title> is perfectly OK. The only place <"> is reserved is in an
attribute value that is delimited by <">. The element "title" is one
of the few elements (maybe the only one?) in XHTML that can contain
character data but no elements.
My inclination instead would be to use:

<meta name="description" content="foo 'bar' baz">

Would there be any difference?
Not really, just follow your personal (or national) preference for
when to use single or double quotation marks.
I assume that I could perfectly well also use:

<meta name="description" content="foo "bar" baz">

or even:

<meta name="description" content="foo “bar” baz">
Yes, both are OK.
when is XHTML 2 going to be usable?
Don't hold your breath. XHTML 1 is not really usable yet because the
most popular browser doesn't support it.
Dean Tiegs <da*******@telus.net> writes:
This is also one of the reasons <object>...</object> is superior to
<img alt="..."/>.


Very interesting. Are you actually recommending this at present?


No, none of the leading browsers support it correctly yet. I use it
in some documents when I don't care how it renders for anybody else,
but for my "real" work I stick to the img element.

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #4

P: n/a
In article <87************@telus.net>,
Dean Tiegs <da*******@telus.net> wrote:
Haines Brown <br****@hartford-hwp.com> writes:
In XHTML docs, I find that the W3 Validator raises an objection to
my headers without actually invalidating the document.

Not in <title></title>, but in meta name="abstract" and
name="description" I find that the inclusion of <q></q> is objected
to by the W3 validator. I'm told "< is first character of a
delimiter, but occurred as data."


I'm not sure if I'm getting what you're saying, but I assume you have
something like

<meta name="description" content="foo <q>bar</q> baz"/>.

This is not valid; you cannot have elements in an attribute value. In
addition, the less-than sign is not allowed literally in an attribute
value at all; it has be represented by &lt; or by a character
reference.


Hmmm. Yes and no. It's certainly not going to achieve the goal you were
after, but AFAICT it's not actually invalid. The Validator is giving
you a warning because it thinks you've made a mistake, but it's not
actually invalid to use a "delimiter as data". Another case of SGML
allowing something that appears completely nonsensical to humans
because it is actually possible to disambiguate it.
BTW, take this with a grain of salt. I'm basing this mainly on OpenSP's
behaviour (i.e. classifying it as a warning and not an error) and
previous instances where SGML has turned out to allow seemingly
ambigious constructs. I haven't actually tried to look this up.

--
T.E.R.J.E. - Technician Engineered for Repair and Justified Exploration
B.L.E.S.S. - Biomechanical Lifeform Engineered for Scientific Sabotage
Jul 20 '05 #5

P: n/a
Dean Tiegs <da*******@telus.net> writes:
The character <"> is not reserved in this context; <title>foo "bar"
baz</title> is perfectly OK. The only place <"> is reserved is in
an attribute value that is delimited by <">. The element "title" is
one of the few elements (maybe the only one?) in XHTML that can
contain character data but no elements.


Thanks you seem to have answered all my questions. I suspected the
situation was as you say, but was not sure.
when is XHTML 2 going to be usable?


Don't hold your breath. XHTML 1 is not really usable yet because
the most popular browser doesn't support it.


--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #6

P: n/a
ni**@fenris.webthing.com (Nick Kew) writes:
In article <m2************@hartford-hwp.com>, one of infinite
monkeys
at the keyboard of Haines Brown <br****@hartford-hwp.com> wrote:
In XHTML docs, I find that the W3 Validator raises an objection to
my headers without actually invalidating the document.


I don't know what you mean by that. Please post a URL that
demonstrates what you're talking about.


Can't very well, for it was a local document not yet n line, so I copy
here one of the offending lines (I here restore it to its original
[offending] condition:

<meta name="description" content="Clôture de la conférence
nationale sur le thème: <q>les droits de la femme tunisienne:
acquis et perspectives</q>" />

The opening first angle bracket within in the content string caused
the alert I quoted before, which seems to boil down to the objection
that I'm using a reserved special character where there should be a
data character.

Any idea why the W3 Validator did not invalidate the document because
of this error?

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #7

P: n/a
On Mon, Jul 21, Dean Tiegs inscribed on the eternal scroll:
<meta name="description" content="foo <q>bar</q> baz"/>.

This is not valid;
Is that really so???
you cannot have elements in an attribute value.
I agree. So the character strings <q> and </q> are just strings of
characters, with no particular significance to (X)HTML, despite their
apparent resemblance to tags.

I reckon the above syntax qualifies as syntactically "valid" (it just
doesn't happen to mean what we might guess it had been intended to
mean).
In addition, the less-than sign is not allowed literally in an
attribute value at all;


Again I question the accuracy of that statement. "Inadvisable",
certainly, but by no means "not allowed", or else I reckon that the
formal validator would report an error, (rather than a warning, which
seems to be what was under discussion here).

Well, I'm sure that this was legal in HTML: can you cite something in
the specifications which rules it out in XHTML? I don't see anything
listed in http://www.w3.org/TR/xhtml1/#diffs for example which would
rule-out this usage.

Jul 20 '05 #8

P: n/a
In article <m2************@hartford-hwp.com>, one of infinite monkeys
at the keyboard of Haines Brown <br****@hartford-hwp.com> wrote:
I don't know what you mean by that. Please post a URL that
demonstrates what you're talking about.


Can't very well, for it was a local document not yet n line,


Any good reason you can't demo it with a five-line dummy document?

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #9

P: n/a
"Alan J. Flavell" <fl*****@mail.cern.ch> writes:
Again I question the accuracy of that statement. "Inadvisable",
certainly, but by no means "not allowed", or else I reckon that the
formal validator would report an error, (rather than a warning,
which seems to be what was under discussion here).

Well, I'm sure that this was legal in HTML: can you cite something
in the specifications which rules it out in XHTML? I don't see
anything listed in http://www.w3.org/TR/xhtml1/#diffs for example
which would rule-out this usage.


The OP had specifically mentioned XHTML, so those were the syntax
rules I was thinking of. (Actually I wasn't aware this was a
difference from HTML, so I just learned something.) Here's the
citation:

"The ampersand character (&) and the left angle bracket (<) may appear
in their literal form only when used as markup delimiters, or within a
comment, a processing instruction, or a CDATA section. If they are
needed elsewhere, they must be escaped using either numeric character
references or the strings '&amp;' and '&lt;' respectively."

<http://www.w3.org/TR/REC-xml#syntax>

Note that attribute values are not listed as an exception. I wonder
why it wasn't an exception? It causes no ambiguity, at least not for
"<". The authors probably just wanted to minimize the exceptions and
make the recommendation clear and simple.

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #10

P: n/a
In article <m2************@hartford-hwp.com>, br****@hartford-hwp.com
says...
ni**@fenris.webthing.com (Nick Kew) writes:
In article <m2************@hartford-hwp.com>, one of infinite
monkeys
at the keyboard of Haines Brown <br****@hartford-hwp.com> wrote:
In XHTML docs, I find that the W3 Validator raises an objection to
my headers without actually invalidating the document.


I don't know what you mean by that. Please post a URL that
demonstrates what you're talking about.


Can't very well, for it was a local document not yet n line, so I copy


If you really can't find any free (and ad-free) webspace then email me a
copy & I'll put it somewhere accessible.

....
Jul 20 '05 #11

P: n/a
On Tue, Jul 22, Dean Tiegs inscribed on the eternal scroll:

[I -ajf- had written, (specifically in regard to the character '<' in
attribute values:]
Well, I'm sure that this was legal in HTML: can you cite something
in the specifications which rules it out in XHTML? I don't see
anything listed in http://www.w3.org/TR/xhtml1/#diffs for example
which would rule-out this usage.
The OP had specifically mentioned XHTML, so those were the syntax
rules I was thinking of. (Actually I wasn't aware this was a
difference from HTML, so I just learned something.)


And so, it seems, did I. How curious that they didn't seem to
point this up as a difference from HTML.
Here's the citation:

"The ampersand character (&) and the left angle bracket (<) may appear
in their literal form only when used as markup delimiters, or within a
comment, a processing instruction, or a CDATA section. If they are
needed elsewhere, they must be escaped using either numeric character
references or the strings '&amp;' and '&lt;' respectively."

<http://www.w3.org/TR/REC-xml#syntax>
So it does, although that's somewhat narrative in nature. But this:

http://www.w3.org/TR/REC-xml#NT-AttValue

appears to clinch the deal, as far as XML is concerned. Does this
restriction carry-over to XHTML, and if so, why isn't it mentioned
here?: http://www.w3.org/TR/xhtml1/#h-4
Note that attribute values are not listed as an exception. I wonder
why it wasn't an exception? It causes no ambiguity, at least not for
"<". The authors probably just wanted to minimize the exceptions and
make the recommendation clear and simple.


Perhaps we could ask the XML group (x-posted).

[please feel free to narrow f'ups to whichever group you see fit.]

Jul 20 '05 #12

P: n/a
ni**@fenris.webthing.com (Nick Kew) writes:
Any good reason you can't demo it with a five-line dummy document?


Nope. I uploaded a truncated document to
www.hartford-hwp.com/archives/test/079.html.

To recall the point, this is a document with a stylistically defined
quotation container <q></q> in the title and the <meta
name="description" content=... lines in the header. This validated OK
in W3, but generated a warning message about the "<" for the latter
line.
--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #13

P: n/a
Haines Brown <br****@hartford-hwp.com> wrote:
ni**@fenris.webthing.com (Nick Kew) writes:
Any good reason you can't demo it with a five-line dummy document?
Nope. I uploaded a truncated document to
www.hartford-hwp.com/archives/test/079.html.


As you can see by looking at your browser's title bar the <q> is
interpreted as just a string of characters and not as the opening tag
of the q element.

Now my French is very rusty but I don't think this is what you want.

<title>How to use the <q> element in a web page</title>
Would be fine and makes sense.

<title>Review: <q>The worst play ever</q></title>
Would not make sense, use " instead.

The same goes for meta tags, except that here you need to use &quot;
or " instead of just " if you have used " to quote the attribute
value as a whole.
To recall the point, this is a document with a stylistically defined
quotation container <q></q> in the title and the <meta
name="description" content=... lines in the header.
As I say above, it is not a "a stylistically defined
quotation container <q></q>".
Iit is just the string of characters <q>.
It is not the <q> element at all.
This validated OK in W3, but generated a warning message
about the "<" for the latter line.


It is valid, but the validator suspects that it might be a mistake on
the author's part.

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 #14

P: n/a
In reply to the previous message, the I had gathered from the
discussion. Actually, that was more or less what I had been doing, but
inadvertantly copied the quote tag over into a meta tag line and then
was surprised that it validated. Thanks for the added input.

As for Steve's point, indeed the only correct quotation marks in
French are the guillemets, but the majority of documents I process use
the English style of quotations, and I don't correct them. The same
for the space between a word and a following ?, : ; or !. For whatever
reason, whoever types the documents leaves the extra space out.

So while "..." is not proper in a French text, most French documents I
encounter, even when typed by a French speaking person in a
predominantly French speaking country use the English quotation
marks. Indeed, an example is the sample document I put up for this
discussion, which is a Tunisian document, but uses the English
quotation marks.

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #15

P: n/a
In article <m2************@hartford-hwp.com>, one of infinite monkeys
at the keyboard of Haines Brown <br****@hartford-hwp.com> wrote:
Nope. I uploaded a truncated document to
www.hartford-hwp.com/archives/test/079.html.
Erm, that has one straightforward error which the validators report
perfectly clearly.
name="description" content=... lines in the header. This validated OK
in W3, but generated a warning message about the "<" for the latter
line.


Erm, not unless it's changed since you wrote that.

--
Nick Kew

In urgent need of paying work - see http://www.webthing.com/~nick/cv.html
Jul 20 '05 #16

P: n/a
Dean Tiegs <da*******@telus.net> writes:
Haines Brown <br****@hartford-hwp.com> writes:
The same for the space between a word and a following ?, : ; or
!. For whatever reason, whoever types the documents leaves the extra
space out.


Different French style guides suggest different spacing. The Canadian
government's style guide for French, _Le guide du rédacteur_,
recommends the no-break space before <:> and inside « and », but not
with any other punctuation.


Dean, sorry to pursue an OT question, but since you have access to a
guide, I wonder if it is also true that the choice of quotation mark
type might not also vary among French speaking nations.

--
Haines Brown
br****@hartford-hwp.com
kb****@arrl.net
www.hartford-hwp.com

Jul 20 '05 #17

P: n/a
Haines Brown <br****@hartford-hwp.com> writes:
Dean, sorry to pursue an OT question, but since you have access to a
guide, I wonder if it is also true that the choice of quotation mark
type might not also vary among French speaking nations.
<blockquote lang="fr-CA"
cite="Le guide du rédacteur, 7.1 Types de guillemets"

Quelle que soit la langue des mots que l'on encadre de guillemets, on
emploie en français les guillemets français. Ils consistent en
doubles chevrons ...

Les guillemets anglais (“ ”), les doubles apostrophes (") et les
simples apostrophes (‘ ’) ne sont utilisés en général que pour les
citations * l'intérieur de citations ou pour guillemeter des mots qui
apparaissent * l'intérieur de passages qui sont déj* entre guillemets
....

Des auteurs et des éditeurs confient parfois des fonctions différentes
aux guillemets français et aux guillemets anglais * l'intérieur d'un
même texte. Par exemple, ils réservent les guillemets français pour
les citation proprement dites, et utilisent les guillemets anglais
pour les mots employés dans un sens spécial.
</blockquote>

The unspoken assumption is that these are the Canadian rules.
Unfortunately it does not mention usage in other countries.

--
Dean Tiegs, NE¼-20-52-25-W4
“Confortare et esto robustus”
http://telusplanet.net/public/dctiegs/
Jul 20 '05 #18

P: n/a
Under Subject: Re: Use of tags in header meta statements
Haines Brown <br****@hartford-hwp.com> wrote:
As for Steve's point, indeed the only correct quotation marks in
French are the guillemets, but the majority of documents I process
use the English style of quotations,
I think you mean Ascii quotation marks, which are _not_ correct
quotation marks in _any_ language (excluding programming "languages"
and other "computer languages") - just surrogates we use in place of
whatever quotation marks we should really be using.

The situation looks strange, since the guillemets (unlike correct
English quotation marks) belong to ISO 8859-1 and hence work almost
universally on the Web. But I think a partial explanation is that you
cannot really achieve correct French typography using just HTML and ISO
8859-1.
The same for the space between a word and a following ?, : ; or !.
For whatever reason, whoever types the documents leaves the extra
space out.


This might have several possible explanations. One explanation is that
the space should be _narrow_, and there's no practical way to say that
in HTML. Maybe people think that no space is then better than a normal
space character.

There's no good solution to this yet, but if you are prepared to extra
markup work and if the issue is important (as it might be e.g. in
headings and other prominent texts), you could consider using &nbsp;
together with <span> markup that lets you set word-spacing suitably,
see http://www.cs.tut.fi/~jkorpela/html/french.html

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

Jul 20 '05 #19

This discussion thread is closed

Replies have been disabled for this discussion.