Saxonica Developer Community: Issueshttps://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2024-03-27T11:18:36ZSaxonica Developer Community
Planio Saxon - Bug #6379 (New): Default implementation of fn:deep-equalhttps://saxonica.plan.io/issues/63792024-03-27T11:18:36ZNorm Tovey-Walsh
<p>I happened to trace my way through a call to deep equal in Saxon HE 12.4 and I was a little bit surprised to find that it's using the <code>DeepEqual40</code> implementation. I wonder if that was intentional...</p> Saxon - Bug #6343 (New): Function Coercion is not always appliedhttps://saxonica.plan.io/issues/63432024-02-11T23:27:14ZMichael Kaymike@saxonica.com
<p>I have created the following test case FunctionCall-058:</p>
<pre><code> declare function local:f($callback as function(xs:integer) as xs:boolean) as xs:boolean {
$callback(year-from-date(current-date()) div 1900)
};
local:f(function($d as xs:decimal) as xs:boolean { $d lt 0 })
</code></pre>
<p>This should fail because the <code>$callback</code> function requires an xs:integer but the supplied value (the result of the integer division) is an xs:decimal.</p>
<p>What is supposed to happen according to the spec is that the supplied function (which accepts an x:decimal) is coerced to the required type (which does not). The means that the function actually supplied to the $callback parameter is effectively:</p>
<pre><code>function($d1 as xs:integer) as xs:boolean {
function($d2 as xs:decimal) as xs:boolean { $d2 lt 0 } ($d1)
}
</code></pre>
<p>which should fail with a type error when called supplying an <code>xs:decimal</code>.</p>
<p>However, because the value supplied to the <code>$callback</code> parameter is an instance of the required type, Saxon skips the process of function coercion wrongly believing it to be unnecessary; his has the effect that the type error is not detected.</p> Saxon - Support #6322 (New): Is the old collation URI in EE supposed to rely on the JDK collation...https://saxonica.plan.io/issues/63222024-01-17T16:12:22ZMartin Honnenmartin.honnen@gmx.de
<p>I notice differences in collation dependent sorts whether I use the UCA URI or the legacy Saxon URI.</p>
<p>The documentation at <a href="https://www.saxonica.com/html/documentation12/localization/sorting-and-collations.html" class="external">https://www.saxonica.com/html/documentation12/localization/sorting-and-collations.html</a> says about collations</p>
<blockquote>
<p>For backwards compatibility reasons the standard collation resolver in Saxon also accepts URIs in the form <a href="http://saxon.sf.net/collation" class="external">http://saxon.sf.net/collation</a> followed by query parameters; the query parameters that are recognized are the same as those defined by W3C UCA collation URIs.</p>
</blockquote>
<p>It appears to me, however, that with EE, the use of the legacy collation URI means ICU is not used, only the default JDK collation support, as I get results similar to using HE.</p>
<p>Can anyone confirm that?</p>
<p>Details below:</p>
<p>An XQuery program using the UCA collation URI, run with Saxon 12.4 EE, gives the same result for all sorts, e.g. the following program outputs true:</p>
<pre><code>declare namespace array = "http://www.w3.org/2005/xpath-functions/array";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
declare option output:item-separator '&#10;';
declare variable $strings as array(xs:string*) external := [
('abc', 'abc def', 'abcdef'),
('abc', 'abcdef', 'abc def'),
('abc def', 'abcdef', 'abc'),
('abc def', 'abc', 'abcdef'),
('abcdef', 'abc', 'abc def'),
('abcdef', 'abc def', 'abc')
];
let $sorted :=
array:for-each(
$strings,
function($seq) {
sort($seq, 'http://www.w3.org/2013/collation/UCA?strength=primary;lang=en')
})
return
every $pos in (1 to array:size($sorted))
satisfies
deep-equal($sorted($pos), $strings?1)
</code></pre>
<p>The same program using the legacy Saxon collation URI, however, gives different sort result, much like Saxon HE, e.g. the program outputs false:</p>
<pre><code>declare namespace array = "http://www.w3.org/2005/xpath-functions/array";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
declare option output:item-separator '&#10;';
declare variable $strings as array(xs:string*) external := [
('abc', 'abc def', 'abcdef'),
('abc', 'abcdef', 'abc def'),
('abc def', 'abcdef', 'abc'),
('abc def', 'abc', 'abcdef'),
('abcdef', 'abc', 'abc def'),
('abcdef', 'abc def', 'abc')
];
let $sorted :=
array:for-each(
$strings,
function($seq) {
sort($seq, 'http://saxon.sf.net/collation?strength=primary;lang=en')
})
return
every $pos in (1 to array:size($sorted))
satisfies
deep-equal($sorted($pos), $strings?1)
</code></pre> Saxon - Feature #6240 (New): Include custom error feedback when using .NET XmlResolverhttps://saxonica.plan.io/issues/62402023-11-06T13:56:33ZEmanuel Wlaschitzemanuel.wlaschitz@hico.com
<p>This is a follow-up to <a class="issue tracker-1 status-3 priority-1 priority-lowest closed" title="Bug: Cannot use InputXmlResolver to implement custom scheme on Saxon-HE 10N (Closed)" href="https://saxonica.plan.io/issues/6214">#6214</a> to get better error feedback to our end-users.</p>
<p>Using a simplified <code>XmlResolver</code>:</p>
<pre><code class="c# syntaxhl" data-language="c#"> <span class="k">sealed</span> <span class="k">class</span> <span class="nc">CustomResolver</span> <span class="p">:</span> <span class="n">XmlResolver</span>
<span class="p">{</span>
<span class="k">private</span> <span class="k">readonly</span> <span class="n">XmlResolver</span> <span class="n">_innerResolver</span><span class="p">;</span>
<span class="k">public</span> <span class="nf">CustomResolver</span><span class="p">(</span><span class="n">XmlResolver</span> <span class="n">innerResolver</span><span class="p">)</span> <span class="p">=></span> <span class="n">_innerResolver</span> <span class="p">=</span> <span class="n">innerResolver</span><span class="p">;</span>
<span class="k">public</span> <span class="k">override</span> <span class="n">ICredentials</span> <span class="n">Credentials</span> <span class="p">{</span> <span class="k">set</span> <span class="p">{</span> <span class="n">_innerResolver</span><span class="p">.</span><span class="n">Credentials</span> <span class="p">=</span> <span class="k">value</span><span class="p">;</span> <span class="p">}</span> <span class="p">}</span>
<span class="k">public</span> <span class="k">override</span> <span class="n">Uri</span> <span class="nf">ResolveUri</span><span class="p">(</span><span class="n">Uri</span> <span class="n">baseUri</span><span class="p">,</span> <span class="kt">string</span> <span class="n">relativeUri</span><span class="p">)</span> <span class="p">=></span> <span class="k">base</span><span class="p">.</span><span class="nf">ResolveUri</span><span class="p">(</span><span class="n">baseUri</span><span class="p">,</span> <span class="n">relativeUri</span><span class="p">);</span>
<span class="k">public</span> <span class="k">override</span> <span class="kt">object</span> <span class="nf">GetEntity</span><span class="p">(</span><span class="n">Uri</span> <span class="n">absoluteUri</span><span class="p">,</span> <span class="kt">string</span> <span class="n">role</span><span class="p">,</span> <span class="n">Type</span> <span class="n">ofObjectToReturn</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">throw</span> <span class="k">new</span> <span class="nf">Exception</span><span class="p">(</span><span class="s">$"The custom url </span><span class="p">{</span><span class="n">absoluteUri</span><span class="p">}</span><span class="s"> is not available. Use doc-available() to test for this before using document()"</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>...and a minimal transformation:</p>
<pre><code class="c# syntaxhl" data-language="c#"><span class="kt">var</span> <span class="n">xsltTransformer</span> <span class="p">=</span> <span class="nf">CompileTestStylesheet</span><span class="p">();</span>
<span class="n">xsltTransformer</span><span class="p">.</span><span class="n">InputXmlResolver</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">CustomResolver</span><span class="p">(</span><span class="n">xsltTransformer</span><span class="p">.</span><span class="n">InputXmlResolver</span><span class="p">);</span>
<span class="k">try</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">output</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">XDocument</span><span class="p">();</span>
<span class="k">using</span> <span class="p">(</span><span class="kt">var</span> <span class="n">outputWriter</span> <span class="p">=</span> <span class="n">output</span><span class="p">.</span><span class="nf">CreateWriter</span><span class="p">())</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">destination</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">TextWriterDestination</span><span class="p">(</span><span class="n">outputWriter</span><span class="p">)</span> <span class="p">{</span> <span class="n">CloseAfterUse</span> <span class="p">=</span> <span class="k">true</span> <span class="p">};</span>
<span class="n">xsltTransformer</span><span class="p">.</span><span class="nf">Run</span><span class="p">(</span><span class="n">destination</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="n">output</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">catch</span> <span class="p">(</span><span class="n">DynamicError</span> <span class="n">ex</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="s">"DYNAMIC ERROR"</span><span class="p">);</span>
<span class="n">Console</span><span class="p">.</span><span class="nf">WriteLine</span><span class="p">(</span><span class="n">ex</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<p>...which is basically:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="nt"><xsl:stylesheet</span> <span class="na">xmlns:xsl=</span><span class="s">"http://www.w3.org/1999/XSL/Transform"</span> <span class="na">version=</span><span class="s">"3.0"</span><span class="nt">></span>
<span class="nt"><xsl:template</span> <span class="na">match=</span><span class="s">"/"</span><span class="nt">></span>
<span class="nt"><root></span>
<span class="nt"><xsl:sequence</span> <span class="na">select=</span><span class="s">"document('custom-scheme://test')"</span><span class="nt">/></span>
<span class="nt"></root></span>
<span class="nt"></xsl:template></span>
<span class="nt"></xsl:stylesheet></span>
</code></pre>
<p>...yields the following console output:</p>
<pre><code>Error at char 9 in expression in xsl:sequence/@select on line 4 column 61 of xslt-custom-uri-scheme-test1.xsl:
FODC0002 Exception thrown by URIResolver resolving `custom-scheme://test` against
`file:///D:/_dev/Saxon10CustomResolverTest1/bin/Debug/xslt-custom-uri-scheme-test1.xsl'.
Caused by net.sf.saxon.trans.XPathException: The custom url custom-scheme://test/ is not
available. Use doc-available() to test for this before using document(). Caused by
cli.System.Exception: The custom url custom-scheme://test/ is not available. Use
doc-available() to test for this before using document()
In template rule with match="/" on line 2 of xslt-custom-uri-scheme-test1.xsl
DYNAMIC ERROR
Exception thrown by URIResolver resolving `custom-scheme://test` against `file:///D:/_dev/Saxon10CustomResolverTest1/bin/Debug/xslt-custom-uri-scheme-test1.xsl'
</code></pre>
<p>The top part is from the internal console writer thats attached by default (...where I'm wondering: Can we redirect this? It sometimes contains additional information that isn't part of a thrown <code>StaticError</code>, <code>DynamicError</code> and isn't passed into the set <code>ErrorList</code> but would be useful to either the end user themselves or at least us as developers) while the bottom part is from catching the <code>DynamicError</code>.</p>
<p>Note that the top part includes the custom exception message, but the bottom part doesn't.</p>
<p>It would be nice if the thrown <code>DynamicError</code> could include the actual exception message <em>somewhere</em> (preferably as <code>InnerException</code> in .NET; not sure if Java would want to use the same approach.) Right now there is no way of getting this info through normal means; the only workaround we could identify was to pass <em>something</em> (like the <code>IMessageListener2</code> we attach anyways) into the <code>CustomResolver</code> and directly call methods on it.</p>
<p>I could only test this against Saxon 10, since there are no HE versions of 11/12 yet (nor do I have a license for it at this point.)</p> Saxon - Bug #6183 (In Progress): "fallback=no" on UCA collation not working in EE editionhttps://saxonica.plan.io/issues/61832023-08-23T01:29:51ZTrevor Lawrence
<p>We are using a licensed (as of 05/04/23) edition of SaxonJ-EE 11.5.</p>
<p>We're using the <code><xsl:sort></code> instruction within an <code><xsl:for-each-group></code> with a custom-defined UCA collation URI. While debugging an issue with it we decided to add the <code>fallback=no</code> parameter to see if we were misusing one of the options, and instead got a message saying it's not supported in Saxon-HE.</p>
<p>Attached to this issue is a minimal stylesheet that reproduces the issue. Invoking it with this command:</p>
<pre><code class="shell syntaxhl" data-language="shell">java <span class="nt">-cp</span> <path_to_xml_resolver_4.6.4>:<path_to_saxon_EE_11.5> <span class="se">\</span>
net.sf.saxon.Transform <span class="se">\</span>
<span class="nt">-xsl</span>:transform-with-EE-feature.xsl <span class="se">\</span>
<span class="nt">-o</span>:file.xml <span class="se">\</span>
<span class="nt">-it</span> <span class="se">\</span>
<span class="nt">-config</span>:<path_to_our_config_and_license>
</code></pre>
<p>gives:</p>
<pre><code>Error at xsl:sort on line 9 column 141 of transform-with-EE-feature.xsl:
XTDE1035 Failed to load collation
http://www.w3.org/2013/collation/UCA?lang=en;maxVariable=symbol;strength=4;alternate=shifted;fallback=no: Error in UCA Collation URI http://www.w3.org/2013/collation/UCA?lang=en;maxVariable=symbol;strength=4;alternate=shifted;fallback=no: fallback=no is not supported in Saxon-HE
Errors were reported during stylesheet compilation
</code></pre>
<p>We currently pull down Saxon-EE from your new Maven repo and XML Resolver from Maven central.</p> Saxon - Bug #6172 (New): In 4.0, keywords in function calls are sometimes ignoredhttps://saxonica.plan.io/issues/61722023-08-15T22:10:05ZMichael Kaymike@saxonica.com
<p>XPath 4.0 allows function calls to provide argument values by keyword as well as positionally.</p>
<p>Some function libraries simply ignore any supplied keywords and interpret all arguments as positional. These include:</p>
<ul>
<li>constructor functions</li>
<li>Java extension functions (both reflexive and integrated)</li>
<li>The xsl:original pseudo-function</li>
<li>Some libraries implemented as Java extension functions,</li>
</ul>
<p>Some function libraries such as EXPath File and Binary are implemented as BuiltInFunctionSets, so keywords should work in principle, but no keyword data has been created, so using keywords will likely fail in unpredictable ways. It's not actually clear what we should do here: should we implement the parameter keywords defined in the spec, even though they were never intended to be used in this way?</p> Saxon - Bug #6127 (New): Documentation: argument keywords in function libraryhttps://saxonica.plan.io/issues/61272023-07-10T07:56:11ZMichael Kaymike@saxonica.com
<p>The documentation of the function library has not kept up to date with changes in argument keywords in the 4.0 specification. For example</p>
<p><a href="https://www.saxonica.com/documentation12/index.html#!functions/fn/reverse" class="external">https://www.saxonica.com/documentation12/index.html#!functions/fn/reverse</a></p>
<p>lists the signature as</p>
<pre><code>reverse($arg as item()*) ➔ item()*
</code></pre>
<p>but the argument keyword has changed from <code>arg</code> to <code>input</code>. The argument keywords are relevant in 4.0 because arguments can be identified by name in a function call.</p> Saxon - Feature #5919 (New): Event APIs for writing XML in SaxonCShttps://saxonica.plan.io/issues/59192023-03-13T11:39:42ZMichael Kaymike@saxonica.com
<p>Currently for writing XML using a push-based event API in SaxonCS we only offer the rather antiquated XmlWriter interface.</p>
<p>Internally we include the Push API (Saxon.Hej.s9api.push) and we use this in the InvalidityReportHandler, but we don't expose it for public use.</p>
<p>We also don't include the Sapling API in the SaxonCS product.</p>
<p>We should consider including one or both of the Push API and the Sapling API - or some improved API that combines the best ideas of the two - in the public SaxonCS API.</p> Saxon - Feature #5709 (New): Compiler and target processor information from fn:system-property()https://saxonica.plan.io/issues/57092022-10-04T08:05:03ZDebbie Lockettdebbie@saxonica.com
<p>Add more (saxon namespace) properties to return compile-time infomation about the target processor and compiler using <code>fn:system-property()</code>. Currently we have <code>xsl:product-name</code> and <code>xsl:product-version</code>: when XJ-compiling for JS, evaluated statically these return for instance <code>"SAXON"</code> and <code>"JS 11.4"</code>. Note that the <code>xsl:product-version</code> value is made up of the target edition and compiler version number; but we don't get the compiler edition (EE). The property <code>saxon:platform</code> can also be used (with SaxonJS) to get run-time information about the platform ("Node.js" or "Browser").</p>
<p>(As originally suggested in SaxonJS <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Status: Closed" href="https://saxonica.plan.io/issues/5698">Bug #5698: Changes for system-property()</a>.)</p> Saxon - Bug #5651 (New): Garbage collection of xsl:key indexeshttps://saxonica.plan.io/issues/56512022-08-18T14:24:21ZMichael Kaymike@saxonica.com
<p>When Saxon builds an index in support of an xsl:key definition, or an implicit xsl:key generated by the XSLT/XQuery optimizer, the intent is that the key remains in memory so long as BOTH the source document AND the compiled stylesheet or query remain in memory.</p>
<p>This appears not to be working. If we run the same query 1000 times against the same source document, we're seeing the index built 95 times. This suggests the garbage collector is destroying it and we're having to rebuild it the next time it's used.</p>
<p>We use WeakReferences to support this policy, and it looks as if we're getting it wrong.</p>
<p>Note: we also need to check how this works on Saxon-CS, as it's probably different.</p> Saxon - Bug #5578 (New): Feature: tracing on .NEThttps://saxonica.plan.io/issues/55782022-06-23T08:38:47ZMichael Kaymike@saxonica.com
<p>See <a href="https://saxonica.plan.io/boards/3/topics/8829" class="external">https://saxonica.plan.io/boards/3/topics/8829</a></p>
<p>The basic tracing infrastructure is present in SaxonCS (the -T option on the command line works), but the APIs to control it are largely missing, and the -TP option (with the underlying TimingTraceListener class) is absent.</p>
<p>The restrictions are not well documented, for example the page "Using XSLT from the command line" does not mark the -TP option as Java-only.</p> Saxon - Bug #5549 (New): Function caching is not applied to tail callshttps://saxonica.plan.io/issues/55492022-05-30T08:11:02ZMichael Kaymike@saxonica.com
<p>If a function f contains a tail-call to a function g, and g is defined with cache="yes", then the cache is ignored and g is executed normally.</p>
<p>See <code>TailCallLoop.tailCallDifferentFunction()</code></p>
<p>(Test case function-1035. I modified the test to make the call not be a tail call; undo this change to demonstrate the problem)</p> Saxon - Support #5469 (New): Combining Configuration Fileshttps://saxonica.plan.io/issues/54692022-05-03T15:25:55ZScott Louzon
<p>To whom it may concern,</p>
<p>I have moved my XSLT creation methodology, in part, to using XSLT packages.
This has been a great new feature over the include/import flow I was previously using.</p>
<p>My last issue is with the encapsulation of the configuration files for pointing to the packages on the cmd-line "-config:".
<a href="https://www.saxonica.com/documentation9.5/configuration/configuration-file/" class="external">https://www.saxonica.com/documentation9.5/configuration/configuration-file/</a>
Unfortunately, I don't see mention of in the example.</p>
<p>Take the following example:
Car package is at the top.
Car package uses Frame, Engine, Wheels, etc.. packages.
Each of the Frame, Engine, Wheel packages could use many other packages, and so on below that.
However, when using the Car package, I don't want to care about the location or structure of everything downstream when building my configuration file for the Car package.</p>
<p>I am wondering what the current methodology recommendation is for building this hierarchy of configuration XML files when using XSLT packages?</p>
<ul>
<li>Always have a "massive" top-level package specify the location of everything you could possibly need to use?</li>
<li>Have a tool (possibly an XSLT) combine all the XML configuration files before-hand, and then use the generated combined file on the command-line?</li>
<li>Some better built in way of pointing to a lower-level configuration file, which in turn can point to the packages it needs, as well as more configuration files?</li>
<li>Don't use configurations files at all, potentially better way to specify package locations and connections?</li>
</ul>
<p>Based on all the information you could pass into a configuration file besides , like XSLT versions and such, I imagine combining configuration files could get tricky.</p>
<p>In general, I want to avoid making a tool to combine XML configuration files in an encapsulated manner, if there is already a better built-in way to do what I want.</p> Non-Conformances - Bug #4220 (New): Exposed visibility of xsl:paramhttps://saxonica.plan.io/issues/42202019-05-15T10:39:14ZMichael Kaymike@saxonica.com
<p>Unit test <code>s9apitests/TestPackage/testPackageRenamingExported</code> is failing with an error saying it cannot accept xsl:param elements with private visibility as hidden.</p>
<p>The spec says (a) that xsl:param elements are always public, and (b) that their visibility cannot be changed by <code>xsl:expose</code> or <code>xsl:accept</code>.</p>
<p>What this test is trying to do is to compile a single package three times with different settings of a static parameter, and then import all three exported packages into a single top-level package (using package aliases to achieve this). It might be that we won't be able to get this to work, but we need to investigate why it's failing the way that it is. The spec says that xsl:param is public, but we're reporting it as private.</p> Non-Conformances - Bug #3531 (New): Substitution groups are not mergedhttps://saxonica.plan.io/issues/35312017-11-16T07:07:38ZMichael Kaymike@saxonica.com
<p>Taking this over as a sub-problem of bug <a class="issue tracker-1 status-3 priority-2 priority-default closed" title="Bug: --multipleSchemaImports has no effect when processing a cycle of schema documents (Closed)" href="https://saxonica.plan.io/issues/3202">#3202</a>.</p>
<p>MHK IntelliJ project Saxon9.8/XBRLTest</p>
<p>When there are several independent calls on SchemaManager.load(), each call on load() results in a new PreparedSchema being built; and if the schema is then found to be valid, its components are merged into the global schema for the Configuration. (We carefully avoid making any changes to the global schema until the new local schema has been verified as being valid.)</p>
<p>If two of these calls on load() specify two different schemas which both import some common schema, it's possible that either or both may declare elements to be in the substitution group of some element declaration in the common schema. When this happens then the process of merging the local schema into the global schema should form the union of the two substitution groups (and in turn, this should trigger recompilation of any affected types). This is not happening: we use one element declaration or the other, but we never merge them in this way.</p>
<p>The logic is complicated by xs:redefine, but let's focus on getting it right in the absence of xs:redefine.</p>