Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

/proc/kallsyms format, sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas

Links

XODOX
Impressum

#1: self-closing tags

Posted on 2008-04-22 18:09:51 by davids58

I'm generating HTML using XSLT. It seems that the XSLT processor wants
to generate self-closing tags when possible, e.g., <a name="XYZ></
a> becomes <a name="XYZ"/>. It seems that at least IE7 doesn't
like this and, as a result, highlights the following content as of it
were part of an anchor tag.

Is there some way for forcing the browser to deal with self-closing
anchors properly? Is this a known problem?

TIA,
David

Report this message

#2: Re: self-closing tags

Posted on 2008-04-22 18:24:40 by jkorpela

Scripsit David Schwartz:

> I'm generating HTML using XSLT. It seems that the XSLT processor wants
> to generate self-closing tags when possible, e.g., <a name="XYZ></
> a> becomes <a name="XYZ"/>.

Bad processor. Such an operation violates the compatibility requirements
that are explicitly stated in both XML and XHTML specifications. Naughty
processor.

> It seems that at least IE7 doesn't
> like this and, as a result, highlights the following content as of it
> were part of an anchor tag.

Of course. IE does not grok XHTML. It's a tag soup slurper that simply
ignores the "/", treating <a name="XYZ"/> as <a name="XYZ">.

> Is there some way for forcing the browser to deal with self-closing
> anchors properly? Is this a known problem?

Huh? The _proper_ treatment of <a name="XYZ"/> by HTML rules up to and
including HTML 4.01 is to treat it as equivalent to <a name="XYZ">/ but
practically no browser gets this right.

Anyway, it is a known problem that an <a> element with empty content
causes problems to some browsers, even when it is written in the classic
HTML style <a name="XYZ"></a> and even though such markup is valid and
conforms to HTML specifications.

So I think the cure is to refrain from generating elements with empty
content. There's almost always some other way. In fact, <a name="XYZ">
is hardly needed these days, when you can use the id="..." attribute on
the element that should be the destination anchor.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Report this message

#3: Re: self-closing tags

Posted on 2008-04-22 18:31:06 by davids58

>
> So I think the cure is to refrain from generating elements with empty
> content. There's almost always some other way. In fact, <a name="XYZ">
> is hardly needed these days, when you can use the id="..." attribute on
> the element that should be the destination anchor.
>
But that would require javascript, right?

David

Report this message

#4: Re: self-closing tags

Posted on 2008-04-22 18:58:17 by Steve Pugh

On Apr 22, 5:31=A0pm, David Schwartz <david...@gmail.com> wrote:
> > So I think the cure is to refrain from generating elements with empty
> > content. There's almost always some other way. In fact, <a name=3D"XYZ">=

> > is hardly needed these days, when you can use the id=3D"..." attribute o=
n
> > the element that should be the destination anchor.
>
> But that would require javascript, right?

Not at all.

<a href=3D"#foo">link</a> will link to <h2 id=3D"foo">heading</h2> in just
about any browser in use today. No JavaScript involved at all.

Steve

Report this message

#5: Re: self-closing tags

Posted on 2008-04-22 19:44:37 by davids58

>
> <a href="#foo">link</a> will link to <h2 id="foo">heading</h2> in just
> about any browser in use today. No JavaScript involved at all.


Cool! Works great! Thanks so much.

Report this message