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

Re: zero width no-break space to prevent tag minimisat

Subject: Re: zero width no-break space to prevent tag minimisation
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 17 Oct 2008 11:44:26 -0400
Re:  zero width no-break space to prevent tag minimisat

At 04:27 AM 10/17/2008, you wrote:
> You've said you can't use the insert-a-comment workaround, although you
> haven't said why.

The comments are stripped out at a later stage, followed by more
stages of parsing/serialising which cause the then empty element to
use the empty element syntax...

I figured it was something like that.

> Would the reason you can't also preclude your using a similar hack, such as
> <div><span/></div>

Good idea... seems too simple :)  I'm trying to think back - why isn't
this the standard approach?  (why do we bother with inserting
comments, #160s etc?)

I think we generally prefer a comment because it best fits the implicit requirement of "do no harm" to the data. (I think the #160 thing probably hearkens back to the nbsp hack for common browsers' display of HTML tables, plus it's invisible while not subject to whitespace-stripping.)

Of course, the same reason comments do the least harm to the data is the reason why they don't always work -- since in some applications, like yours, they are considered by the same reasoning to add nothing, hence subject to stripping.

It's a good example of how the best solution is actually sensitive to the requirements -- "best" is relative. You have an edge case so what's usually best isn't best for you. (And what's an edge case for me might be normal for you -- something developers frequently forget. :-)

Another possibility to consider is plugging a nugatory PI in there as your doorstop:

<div><?open and close?></div>

-- which might be the in-between choice. (Dunno if your process drops PIs along with the comments.)


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
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

Current Thread


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.
First Name
Last Name
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.