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

Re: A plea for Sanity


pretty printer xslt

Eric van der Vlist wrote:

> What about declaring those documents?
> <?sanity type="normal|sane|neurotic|psychotic"?>
> with a default value of psychotic (unfortunately, but you can't assume
> documents to be normal nor even sane) would allow consumers to adapt
> their behavior or even to reject documents they don't like...

I'm not sure how much a declaration would help.
If a consumer is prepared to adapt its behaviour --
using a simple algorithm if the document is sane and
a complex one otherwise -- it might as well just implement
the complex algorithm and use it for all cases.
If it's going to reject documents with a namespace pathology,
it might as well raise an exception when the pathology
is detected; a PI in the document prolog would only enable
a "fast failure" mode but not much else.

(Besides that, I don't think it's usually a good idea to include
declarations for properties that can be determined from
the document instance.  What do you do when the declaration
is incorrect?  What if it's missing?)

I like Evan's suggestion (from later in the thread) better.
The important criterion is whether or not the namespace
environment is significant (which is mostly determined
by whether or not there are QNames in content).  The sanity
or otherwise of the source document only affects how difficult
it is for an application to achieve this.

Even so, I don't think an '<?xmlns preserve="yes|no"?>' declaration
would be helpful either.  Whether or not the namespace environment
must be preserved is not a property of the document instance; it's
determined by the source markup vocabulary and the nature of the
transformation.  For example, consider an XSLT pretty-printer
that renders an XSLT stylesheet as XHTML.  The namespace environment
is significant when interpreting XSLT *as XSLT*,  but the
output of the pretty-printer will only contain elements in
the XHTML namespace.

I think the important question is whether or not an *application*
preserves the namespace environment, and under what circumstances.
"Always", "never", and "for {sane|non-neurotic|non-psychotic} documents
only" are possible answers.  It's the user's responsibility not
to feed a document to an application that can't process it correctly.
For instance if an XML database only guarantees namespace preservation
for sane documents, you mustn't use it to store neurotic XSLT stylesheets.


--Joe English

  jenglish@f...

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.