[xsl] XSLT exception handling, HTTP/POST and more ... (update)

Subject: [xsl] XSLT exception handling, HTTP/POST and more ... (update)
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 05 Dec 2002 16:59:28 -0500
Hi,

regarding my Saxon extensions for exception handling and HTTP/POST
interactions, I have now created a project on source forge. It's
called the XSLT Web Services Framework (XWSF) [http://sourceforge.net/projects/xwsf]. Right now it comes with
a little Servlet that will run the request message against an XSLT
transform to produce the response message. There is a rudimentary
SOAP adapter that handles the SOAP overhead so that the specific
transforms only need to do contain the stuff that deals with the SOAP
body.


The exception and post:message extensions are available for server
and client XSLTs. Some demos are included that show how ridiculously
simple it is to call web services from XSLT.

I made no release yet, just CVS, but feel free to grab it through
CVS. The code is actually usable, but the build and deployment
process is still largely manual. If someone is insterested in helping
with this code for the Xalan side of the world, please drop a note.

Michael Kay has noted that one problem of exception catching is:
what do you do with the partially generated output tree? Well,
I fixed this issue now: the xsl:try block buffers the generated
tree and only outputs it when the ex:try block was successful.
This works nicely for small try blocks now. But if the try
block produces huge amounts of data (e.g., a batch of thousands
of documents) it runs out of memory. So, I have added a switch
to ex:try where you can say <ex:try atomic="no"> and then it
will output directly. I do nest atomic try blocks in non-atomic
ones when generating a node sequence, to be sure never to
generate a parial node, but allow a sequence to be truncated in
case of an exception. E.g.,

<list>

<ex:try atomic="no">

<xsl:for-each ...>

<ex:try atomic="yes">

<xsl:apply-templates mode="createthisnode"/>

        <ex:catch exception="java.lang.Throwable">
          <exception msg="{ex:current-exception()}">
             The node causing this exception was not output because
	     it was incomplete!
          </exception>
          <ex:throw select="ne:new()" xmlns:ne="java:my.NodeError"/>
        <ex:catch>

</ex:try>

</xsl:for-each>

    <ex:catch exception="java.lang.Throwable">
      <exception msg="{ex:current-exception()}">
         The list was truncated because an exception occurred.
      </exception>
    <ex:catch>

</ex:try>

</list>


regards, -Gunther



--
Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread