RE: [xsl] HOWTO: Internet Explorer conditional comments in XSLT 1.0

Subject: RE: [xsl] HOWTO: Internet Explorer conditional comments in XSLT 1.0
From: "Nick Fitzsimons" <nick@xxxxxxxxxxxxxx>
Date: Tue, 1 Nov 2005 08:57:01 -0000 (GMT)
> I'm not sure you emphasize strongly enough the key limitation in this
> approach: in the data model, comments cannot contains elements, they can
> only contain strings; so you need to construct your content as a string in
> which the markup is hand-generated. If the stuff between IE's conditional
> comments gets complicated then this is going to become a pain, especially
> if
> you have to produce it by modifying existing stylesheets that were
> designed
> to produce the content as real element trees.
>

Yes, it's true that the approach could be messy for anything too complex.
I probably didn't emphasise enough that I was thinking of this primarily
in the context of generating a straightforward <link> as in the example,
as that seems to address the original problem of applying CSS hacks in a
clean manner.

> The stuff on result-tree-fragments is a bit tangential. The content could
> just as well be a string. There's no special RTF "magic" here. All that's
> happening is that when a string contains the "<" character, and the string
> is used to form the body of a comment, the "<" is left as a "<" and isn't
> escaped to "&lt;".
>

Good point; I'll have to rework that bit. Thanks :-)

> Incidentally, you also have to worry about the fact that the comment can't
> contain "--" (and therefore, can't contain nested comments).
>

To be honest, I haven't ever experimented with including comments inside a
conditional comment; I wonder if it would break...

Thanks for your comments; I'll update the article to reflect these points
(as soon as I get some time free from work).

Cheers,

Nick.

> Michael Kay
> http://www.saxonica.com/
>

-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/

Current Thread