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

RE: document() function and error-handling

Subject: RE: document() function and error-handling
From: "Scott Trenda" <Scott.Trenda@xxxxxxxx>
Date: Fri, 4 Jan 2008 12:30:53 -0600
RE:  document() function and error-handling
> On a different level, being not sure I read every single letter on
this
> thread yet, was it already proposed to use a proxy? Because with a
proxy
> (which has hardly anything to do with XSLT of course), you can just do

> whatever you want.

> I.e., suppose you create a proxy HTTP server that resides on the same
> server as your Coldfusion stuff, suppose that
> http://localhost:123456/proxy? runs a proxy script and that you call
it
> as http://localhost:123456/proxy?url=http://test.com/doesnotexist. Now

> your proxy script must do two things:

>   1. test if the url exists and if not, reply with an XML compatible
error
>   2. test if the result is a valid XML document and if not reply with
an
> XML compatible error, if yes, reply with the XML result itself.

> By doing something like that, you've taken the burden of your XSLT and

> you do not need to result to complex platform specific solutions. In
> fact, the solution will be very portable (and is close to what you
> would've done if you implement the XmlResolver solution, which however

> is in practice much harder with MSXML alone).

*blink*

Now I'm a little angry - that's the best solution that I've heard so
far, but it's so simple! Why didn't I think of that. It'll actually fit
in quite well with the flow of several other scripts in our system, and
will undoubtedly be useful in other places. A thousand thanks for the
suggestion, but damn I feel stupid after reading it. :)


I'd like to implement it somewhat like the MSSQL "FOR XML AUTO" error
messages, like so:
<?xml-result xml-status="0" http-status="404" description="File not
found" ?>
<?xml-result xml-status="0" http-status="200" description="Invalid XML
content" ?>
<?xml-result xml-status="1" ?><!-- retrieved document here -->

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. (And is it an XML faux pas to start the PI with "xml-"?)
The result effect I'd want is for the caller to be able to
apply-templates to document(...) or document(...)/* with little to no
variation in the transformation's behavior, but the script's result
would still be available, error or not. And the PI content could be
similarly passed down to the result document if desired:
  <template match="processing-instruction('xml-result')">
    <xsl:copy-of select="."/>
  </template>

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.

~ Scott

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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
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-2007 All Rights Reserved.