Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

throwing an exception from XSLT

Pollocks01Nov 23 2011 — edited Nov 24 2011
Just wanted to share a finding with the Oracle XDB community and possibly suggest an enhancement to the xdb product development team (care of MDRAKE).

I had a scenario where I wanted to throw an exception from the XSLT.

A little Googling revealed this helpful post:

http://weblogs.asp.net/george_v_reilly/archive/2006/03/01/439402.aspx

...so I gave it a shot.

In my XSLT, I have a <xsl:choose> block with the following <xsl:otherwise> block:
<xsl:otherwise>
    <xsl:message terminate="yes">Unknown Document Type</xsl:message>                           
 </xsl:otherwise>
I used a stub test to run this through, giving it a file which would exercise the exception:
select xmltype(bfilename('XML_RESOURCES', 'data.xml'),0).transform(xmltype(bfilename('XML_RESOURCES', 'sanitize_xml.dev.xsl'),0))
from dual;
..and to my 'joy', I did get an exception:
ORA-30998: transformation error: execution of compiled XSLT on XML DOM failed
Hmm...would of been nicer to get something like what Eclipse/Xalan pops out:
file:/H:/eclipse_indigo_workspace/XSLT/sanitize_xml.xsl; Line #28; Column #59; Unknown Document Type
(Location of error unknown)Stylesheet directed termination
...i.e. my custom error message "Unknown Document Type" isn't output by Oracle.

Just to be safe, I tried a file which would NOT exercise this xsl:otherwise block and it did run through OK.

So, could XDB report a better error?

Thoughts?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2011
Added on Nov 23 2011
18 comments
2,770 views