RE: [xsl] XSL: Error Detection?

Subject: RE: [xsl] XSL: Error Detection?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 11 Mar 2003 15:51:05 -0000
You can write a new stylesheet module which imports the current one, and
contains a single template rule of the form:

<xsl:template match="*">
<xsl:choose>
  <xsl:when test=".... node is in error subtree ...">
     ..do something.
  </xsl:when>
  <xsl:otherwise>
     <xsl:apply-imports/>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>

The only caveat is that this assumes you are not using apply-templates
with parameters.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Bhandari, Ashish
> Sent: 11 March 2003 14:23
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject: [xsl] XSL: Error Detection?
> 
> 
> 
> Hi,
> 
> I have an input XML of which I am interested only in a subset 
> of the nodes for transalting into another XML doc. 
> 
> I have written stylesheets ( and these are substantially 
> large ones ) for the translation.
> 
> Now the problem is the input XML is generated automatically 
> in which case there might be errors ( in generation )  and 
> some nodes that I am interested in translating may not be 
> generated. However, the input XML will have an "ERROR" 
> subtree as a decendant of the root indicating a failure and 
> detailing the node name, context and error string.
> 
> 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 ?. 
> 	
> 
> Thanks,
> Ashish.
> 
> 
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread