[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <empty /> vs <empty></empty?

Subject: Re: <empty /> vs <empty></empty?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Dec 2005 08:27:53 -0500
html underline empty
At 2005-12-11 14:21 +1100, Eric Scheid wrote:
Is there any way to control whether empty elements appear as
<empty></empty>, instead of <empty/>?

No, that is outside the specification. A vendor might offer that as a feature, but there is no control in the W3C spec.


My problem is that some browsers don't like <div/> or <a name="x"/>, not
recognising that they both begin and *end* there, thinking instead they are
opening tags only.

Indeed ... in my class I use the following as an example (note that one has to first substitute "< " with "<" as I've escaped the markup so this will work in mailers):


< ?xml version="1.0" encoding="utf-8"?>
< !DOCTYPE html
 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">
< head>
 < title>test< /title>
 < meta http-equiv=
       "Content-type" content='text/html; charset="utf-8"' />
< /head>
< body>
< div>Div is normal< /div>
< div style="font-style:italic">Div is italic< /div>
< div style="text-decoration:underline" />
< div>No underline< /div>
< div style="font-weight:bold">< /div>
< div>No underline or bold< /div>
< /body>
< /html>

The above works just fine in Opera and in Firefox, but not in Internet Explorer.

This presents a problem when the transformation doesn't find content and ends up producing the empty element in the result tree: the formatting for that empty element "bleeds" to the end of the document.

As a workaround, I believe I can do this:
    <a name="x"><xsl:comment> empty </xsl:comment></a>

Kewl! I hadn't thought of forcing it that way. Thanks!


. . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:  Denver,CO March 13-17,2006
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.