Hi,
At 01:59 PM 8/31/2005, you wrote:
> Even though it makes me quesy, it should be possible to write this
> just as a comment.
>
>> <xsl:text disable-output-escaping="yes"><!--[if IE]></xsl:text>
>> <link rel="stylesheet" type="text/css"
href="/~rodney/times/css/ieonly.css" media="screen" />
>> <xsl:text disable-output-escaping="yes"><![endif]--></xsl:text>
>
> as the comment that it really desires to be should just be:
>
> <xsl:comment>[if IE]><link rel="stylesheet" type="text/css"
> href="/~rodney/times/css/ieonly.css" media="screen"
> /><![endif]</xsl:comment>
Well, the link element gets parsed as a node and the comment output
does not have any link in it. It (xsltproc) also tries to parse
"<![endif]" and pukes on the ! in the element name. It would also
puke if it ever got to the missing >.
Yes. Details Jon missed. Actually the ">" would be fine; it's only the "<"
that will be a problem.
Escape it as < and you'll be fine there too.
But a little modification give
this:
<xsl:comment><![CDATA[[if IE]><link rel="stylesheet" type="text/css"
href="/~rodney/times/css/ieonly.css" media="screen"
/><![endif]]]></xsl:comment>
which does produce the same output.
So would
<xsl:comment>[if IE]><link rel="stylesheet" type="text/css"
href="/~rodney/times/css/ieonly.css" media="screen"
/><![endif]</xsl:comment>
But I'm not sure this is better
markup than using "disable-output-escaping".
It is.
Specifically, if I had
to use variables inside the CDATA section; I'd be up a creek.
You can include them if you don't escape the entire section from being
parsed with the CDATA marked section (as shown above), but only escape the
open markup delimiters (< and &).
It's actually *very* rare to need disable-output-escaping. Almost without
exception it turns out there's an easier way; and when there isn't it's
usually for reasons outside the XSLT.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--