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

RE: XSL: Error Detection?

Subject: RE: XSL: Error Detection?
From: "Martinez, Brian" <brian.martinez@xxxxxxxx>
Date: Tue, 11 Mar 2003 08:20:47 -0700
xsl error
> From: Bhandari, Ashish [mailto:Ashish.Bhandari@xxxxxx]
> Sent: Tuesday, March 11, 2003 7:23 AM
> Subject:  XSL: Error Detection?
> 
> Hi,
> 
> Now: I have these constraints:
> 	- The Stylesheet is already done and it is an overkill 
> for each node
> translation to check for the node in the "ERROR" subtree.
> 	- Since I am translating only a subset , I will not be 
> interested in
> the "ERROR" subtree if the nodes that I am translating are 
> not specified in
> the subtree.
> 	- NOTE: It IS possible to change the way,means and mode 
> the input
> XML reports the error.
> 
> Goal:
> 	 Is it possible , with minimum invasion, to make the styleesheet
> capable of such error detection ?. 

I'm not sure I understand your question fully, but I'll assume that your
stylesheets each look for a single node in the input tree to transform.  If
so, then you could check for the presence of an error condition at the
beginning of the transformation:

<xsl:template match="/">
  <xsl:choose>
    <!-- you may need to use "ERROR//some-node" instead -->
    <xsl:when test="ERROR/some-node">
      <!-- report error condition -->
    </xsl:when>
    <xsl:otherwise>
      <!-- perform transformation as usual -->
    </xsl:otherwise>
  <xsl:choose>
</xsl:template>

If an error in the XML formatting occurs, does it move the problem node to
the ERROR node-set so that it doesn't appear in its normal place in the
tree?  If so, you could have two matching templates--one which outputs
whatever your error message is, and one to transform the normal input:

<!-- Error handling -->
<xsl:template match="/document/ERROR/some-node">
  <!-- etc. -->
</xsl:template>

<!-- Normal operation -->
<xsl:template match="/document/some-node">
  <!-- etc. -->
</xsl:template>

Even if your node-set still appears in the rest of the input tree, you could
add the error-handling template to the beginning of your current stylesheet,
which would allow you to output error messages and meet your "minimum
invasion" criterion.

hth,
b.

| brian martinez                              brian.martinez@xxxxxxxx |
| lead gui programmer                                    303.708.7248 |
| trip network, inc.                                 fax 303.790.9350 |
| 6436 s. racine cir.                             englewood, co 80111 |
| http://www.cheaptickets.com/                   http://www.trip.com/ |

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

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