Bug #1866
closedParse errors in imported stylesheet cause no exception
100%
Description
Reported by SHARMILA SUBRAMANIAM tssharmila@gmail.com 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