RE: [xsl] document() function and error-handling

Subject: RE: [xsl] document() function and error-handling
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 04 Jan 2008 16:18:55 -0500

At 01:30 PM 1/4/2008, you wrote:
Would there be any reason *not* to include an <?xml-result?> PI in the
result document? As I understand it, this sort of thing is what PIs were
designed for.

Yes, it is. PIs are for application-specific information, which is for your application, a signal, but for anyone else's, noise.

(And is it an XML faux pas to start the PI with "xml-"?)

Yes it is, and not just a faux pas but formally illegal. XML does reserve the characters "[X|x][M|m][L|l]" in names, for use by W3C. And the definition of PI targets does say:

The PI begins with a target (<>PITarget) used to identify the application to which the instruction is directed. The target names "XML", "xml", and so on are reserved for standardization in this or future versions of this specification.

This doesn't actually exclude names that only start with "xml", but on the other hand, a PITarget is defined as a name, which does. (And in any case, you'd be abusing the spirit if not the letter to use it, etc.) Parsers, it is true, sometimes fail to enforce this restriction on names.

In SGML, it was considered good manners actually for the PI target to identify the application at which it is aimed (hence the name "target"), and even for a NOTATION declaration to be used to enable a system to determine something about that application and perhaps resolve it dynamically. But no one does that any more.

Nevertheless, it would seem like good design in principle to name your PI target in such a way that other applications that might eventually see your data (and the whole idea of XML is that you never say never about that) can have some assurance that the PI is really noise for them, not signal.

Just wondering if extraneous PIs in transformation source/result
documents are considered good coding convention or not. It'd be nice to
actually make use of them from time to time.

That's what they're there for. Just don't go overboard and start to code actual document semantics in them (as opposed to application semantics).

Note: this has stopped being an XSLT issue! :-)


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
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