self-closing tags

self-closing tags

am 22.04.2008 18:09:51 von davids58

I'm generating HTML using XSLT. It seems that the XSLT processor wants
to generate self-closing tags when possible, e.g., . 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

Re: self-closing tags

am 22.04.2008 18:24:40 von 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.,
.

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

> 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
by HTML rules up to and
including HTML 4.01 is to treat it as equivalent to
/ but
practically no browser gets this right.

Anyway, it is a known problem that an
element with empty content
causes problems to some browsers, even when it is written in the classic
HTML style 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,

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/

Re: self-closing tags

am 22.04.2008 18:31:06 von davids58

>
> So I think the cure is to refrain from generating elements with empty
> content. There's almost always some other way. In fact,

> 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

Re: self-closing tags

am 22.04.2008 18:58:17 von Steve Pugh

On Apr 22, 5:31=A0pm, David Schwartz wrote:
> > So I think the cure is to refrain from generating elements with empty
> > content. There's almost always some other way. In fact,
=

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

will link to

heading

in just
about any browser in use today. No JavaScript involved at all.

Steve

Re: self-closing tags

am 22.04.2008 19:44:37 von davids58

>
> will link to

heading

in just
> about any browser in use today. No JavaScript involved at all.


Cool! Works great! Thanks so much.