[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] generating conditional comment in html output


Subject: Re: [xsl] generating conditional comment in html output
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Wed, 09 Feb 2011 20:35:20 +0100

I succeeded with something like

    <xsl:comment>[if lte IE 7]>
    &lt;style media="screen,projection,print" type="text/css">
      @import url("../stylesheet/ie7-fix.css");
    &lt;/style>
    &lt;![endif]</xsl:comment>

At least this is a syntactically correct comment.

But as Adorno put it, Wrong life cannot be lived rightly.

-Gerrit

On 2011-02-09 20:17, Trevor Nicholls wrote:
Hi

I have a stylesheet which has been turning XML into HTML without batting an
eyelid but somebody has requested that the output HTML contain some
conditional styling. This means that at one point in the output I have to
insert the string

<!--[if gte IE 7]>

and at another point I have to insert the string

<![endif]-->

I've tried using&lt; in<xsl:text>, using<xsl:value-of>  a variable, using
d-o-e, and none of these options seems to work. They either display the
conditional comment in the browser with<  and>  (and an editor shows the
literal string "&  l t ;" in the HTML) or without, or I get errors telling me
I have malformed code. I'm processing with Saxon in XSL2, and rendering with
IE7 and IE8.

What is the proper way to do this please? I found many potential answers in
the FAQ but I haven't found one that works :-(

Cheers
T


-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler


Current Thread
Keywords
xml