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(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com
-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Bhandari, Ashish
Sent: 11 March 2003 14:23
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
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