At 2007-08-03 19:19 +0200, Manfred Staudinger wrote:
On 03/08/07, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
> There is a cdata-section-elements on xsl:output, but not a
> never-minimize-elements attribute or something similar.
There is no need for such an attribute, because MSXML3 handles
the two cases differently. If you specify in your stylesheet
<div style="display: none"/> it becomes <div style="display: none" />
(invalid html)
but
<div style="display: none"></div> becomes <div style="display: none"></div>
in the output.
Note that there is _no_ need to using nbsp or xsl:comment to ensure
valid html !
I disagree with your summary above based on my own experiences that
when using the HTML serialization with MSXML and other tools. The
distinction you make is for XML serialization, not for HTML
serialization. But such behaviour is outside of the XSLT 1.0
specification. Note that the XPath data model for XML instances does
not distinguish the syntax with which an empty element is expressed.
Note below that when HTML serialization is specified, both MSXML and
Saxon expose the end tag of the empty element. When XML
serialization is specified (which is required for XHTML in XSLT 1.0),
MSXML preserves the distinction (which is not required to be done)
and Saxon does not preserve the distinction (which is acceptable).
I hope this helps.
. . . . . . . . . . . . . Ken
t:\ftemp>type manfred.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<body>
<div style="display: none"></div>
<div style="display: none"/>
</body>
</xsl:template>
</xsl:stylesheet>
t:\ftemp>xslt-msxsl manfred.xsl manfred.xsl con
<body>
<div style="display: none"></div>
<div style="display: none"></div>
</body>
t:\ftemp>xslt-saxon manfred.xsl manfred.xsl con
<body>
<div style="display: none"></div>
<div style="display: none"></div>
</body>
t:\ftemp>type manfred2.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<body>
<div style="display: none"></div>
<div style="display: none"/>
</body>
</xsl:template>
</xsl:stylesheet>
t:\ftemp>xslt-msxsl manfred2.xsl manfred2.xsl con
<?xml version="1.0" encoding="UTF-16"?>
<body>
<div style="display: none"></div>
<div style="display: none" />
</body>
t:\ftemp>xslt-saxon manfred2.xsl manfred2.xsl con
<?xml version="1.0" encoding="utf-8"?>
<body>
<div style="display: none"/>
<div style="display: none"/>
</body>
t:\ftemp>
--
Upcoming public training: XSLT/XSL-FO Sep 10, UBL/code lists Oct 1
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--