Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "Scott Trenda" <Scott.Trenda@-------->
To:
Date: 1/4/2008 6:31:00 PM
> 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent