Re: Trimming (formatting-only) leading tabs/spaces fro
On 6/7/2011 1:42 PM, Philip Fearon wrote:
In XML (and SGML, including SGML-conformant HTML), I think this means you can follow a schema -- significant whitespace is anywhere character data is permitted. Regrettably, this means that all whitespace (outside tags) is significant when there is no schema. (Whether you can take a schema to be implicit when it is not given is another problem.)
This sounds reasonable to me. Or, it does not sound unreasonable, which may be almost the same thing.
Finally, I think it's important to distinguish between whitespace handling in tag-formatting applications from the way whitespace may, or may not, be collapsed, re-flowed or munged for display in a receiving application. These are two different issues that are frequently confused. The fact that some tag-formatting applications may (usefully) reformat whitespace in some places where it is not entirely stripped -- perhaps on the grounds that receiving applications will be doing likewise, so it doesn't matter -- makes for another set of troublesome blurry cases.
I think you're reading the distinction correctly.
A developer can then, by changing the view (in the receiving application), choose a preferred indentation style or select none at all without affecting a single character. Hopefully there isn't a blurry case once you can say that all characters in the XSLT are there on merit (though some will still fulfill a text formatting role, say for XPath), not because an XML 'pretty-print' system needs them (I hope this doesn't sound emotional - its not meant to).
Fortunately, the XSLT specs are clear on this point: whitespace-only text nodes in a stylesheet have no semantics that an XSLT processor is bound to respect, outside xsl:text, while it is bound to respect any whitespace mixed with non-whitespace text.
Because whitespace-only text nodes outside xsl:text can have no significance in a stylesheet as processed, the law of parsimony argues that an editing application might similarly be allowed to do with them what it will (or do away with them as the case may be).
====================================================================== 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 ======================================================================
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format