Project

Profile

Help

Bug #4301

closed

Incorrect namespace URI in error code produced using fn:error()

Added by Jiri Dolejsi over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2019-08-27
Due date:
% Done:

100%

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

Description

I do not know, if it is a bug or my misunderstanding.

using System;
using Saxon.Api;
using System.IO;
using System.Text;
using System.Collections.Generic;

namespace TestSaxon
{
    class Program
    {
        static Processor processor = new Processor(true);
        static String s = @"<xsl:transform version='3.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:xs='http://www.w3.org/2001/XMLSchema'>" +
       @" <xsl:template name='xsl:initial-template' as='xs:string'> " +
       @"    <xsl:param name='code' as='xs:string'/> " +
       @"    <xsl:sequence select=""if ($code = ('test')) then $code else error(QName('http://www.ctk.cz/error-code/', 'NotExists'))""/> " +
       @" </xsl:template>" +
       @" </xsl:transform>";

        static void Main()
        {
           try
           {
                XsltCompiler comp = processor.NewXsltCompiler();
                Xslt30Transformer transformer = comp.Compile(new StringReader(s)).Load30();
                var p = new Dictionary<QName, XdmValue>();
                p.Add(new QName("code"), new XdmAtomicValue("abc"));
                transformer.SetInitialTemplateParameters(p, false);
                XdmDestination dest = new XdmDestination();
                transformer.CallTemplate(null, dest);
            }
            catch (Saxon.Api.DynamicError err)
            {

                if (err.ErrorCode.Uri == "http://www.ctk.cz/error-code/")
                {
                    return;
                }
                else
                    throw;
             
            }
        }

    }

}

I expect exception with my custom namespace, but Saxon throws exception, which says, that it can not serialize result

When I omit as attribute inside or use as='item()*' then it works.

I am using Saxon EE, 9.1.1.4, .NET Framework 4.7

Please register to edit this issue

Also available in: Atom PDF