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

Subject: RE: [xsl] document() function and error-handling
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Fri, 4 Jan 2008 16:50:20 -0600
Wendell,

Thanks for your reply. Well explained, and good practical points on top
of it. The result document in this case would only be used internally by
our system, so <?oati-xml-result?> would work just fine in this case.

My reasoning behind <?xml-result?> is this:
I'm writing the behind-the-scenes valid-URL testing to be as generic as
possible in the proxy script, perhaps even resorting to a try-catch XSLT
run with a stylesheet that simply attempts to access the URL via
document() to see if it fails or not. I might port it to other systems
if it proves generic enough, and <?oati-xml-result?> would include the
name of a company that has nothing to do with the process. (Replace
"oati" with "microsoft" here and it might become more poignant. ~_^)
Granted, <?xml-result?> isn't a W3C-endorsed PI at all, but it does
contain information regarding the XML-validity of an attempted reference
to an external document, and nothing more specific than that. Wouldn't
"xml-" be the most appropriate prefix here?

(For the record, I'm really bad at naming things when it comes to
computer stuff. :/ )

~ Scott


P.S. Where exactly would you draw the line when it comes to XSLT issues
vs. XML issues? XSLT is, after all, XML. :)


-----Original Message-----
From: Wendell Piez [mailto:wapiez@xxxxxxxxxxxxxxxx]
Sent: Friday, January 04, 2008 3:19 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] document() function and error-handling

Scott,

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
>(<http://www.w3.org/TR/REC-xml/#NT-PITarget>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! :-)

Cheers,
Wendell



======================================================================
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