Project

Profile

Help

Bug #1866

closed

Parse errors in imported stylesheet cause no exception

Added by Michael Kay over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
s9api API
Sprint/Milestone:
-
Start date:
2013-08-21
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Reported by SHARMILA SUBRAMANIAM in direct email to MHK:

I'm trying to compile an xsl which imports other xsl files(sample below: test1.xsl imports CA.xsl) . If there are errors in the main xsl (test1.xsl )it is caught in the catch block. But the errors in the xsl files(CA.xsl) which are being imported using xsl:import are not getting caught. For example

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="CA.xsl"/>

</xsl:stylesheet>

CA.xsl has some errors for example : end tag is missing. But those errors are not caught and errorlist count is 0.

try

{

// To get error message in detail , Error List property is set.

List errorList = new List();

xsltCompiler.ErrorList = errorList;

transformer = xsltCompiler.Compile(

new Uri(xsltLocation)).Load();

}

catch(Exception)

{

if (xsltCompiler.ErrorList.Count > 0)

{

errorMessage = xsltCompiler.ErrorList[0].ToString();

}

System.Diagnostics.

Trace.WriteLine(errorMessage);

throw new Exception(errorMessage);

}

If I change the location of CA.xsl, it is throwing error that file cannot be found, meaning that the imported stylesheet is referenced but it is not getting compiled .

Thanks

T.S.Sharmila

NOTE: the user also reported

I’m using Saxon 9.3 ee version in .Net 4.5, with no license file.

Please register to edit this issue

Also available in: Atom PDF