Saxonica Developer Community: Issueshttps://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2024-03-19T09:54:05ZSaxonica Developer Community
Planio SaxonJS - Bug #6374 (New): saxon.compile removed in 2.6+?https://saxonica.plan.io/issues/63742024-03-19T09:54:05ZJai B
<p>Hi,</p>
<p>I've always used the <code>saxon.compile</code> function to generate sef files in code. I know it's undocumented but IIRC it was shown in the command line docs or something.</p>
<p>Basically I cache the compiled sef so I don't have to recompile everytime I want to do a transform and I don't want to pre-transform my XSLT files on the command line, nor do I have any desire to use the Java version for that part, the JS compiler has worked amazingly!</p>
<p>My web app does server side transformations with node; anytime it sees the XSLT change, it runs a compile to generate and cache a new sef to use for subsequent transformations. I can't cache the result of the transformation either since the data is dynamic, of course.</p>
<p>Perhaps I'm missing something or missing some changes, but this has worked awesome for years and only just noticed things breaking when redeploying some stuff and npm updating to 2.6.0 and getting an error that the function doesn't exist.</p>
<p>When I was initially implementing this, I know I spent a fair bit of time trying to figure this part out and ensure I was doing things right; I think I scoped the code that generates the sef on command line to find the function in the first place and was surprised it wasn't actually documented/available anyway.</p>
<p>Thanks again for SaxonJS!</p> SaxonJS - Feature #6355 (New): A new instruction that makes a document available by the document(...https://saxonica.plan.io/issues/63552024-02-20T15:42:25ZMartynas Jusevicius
<p><code>ixsl:schedule-action</code> supports <code>@document</code> and <code>@http-request</code>. Both approaches have their advantages.
For <code>@schedule-action</code>:</p>
<blockquote>
<p>The called template can access the documents using the <code>doc()</code>, <code>document()</code>, <code>doc-available()</code>, <code>json-doc()</code>, <code>unparsed-text()</code>, <code>unparsed-text-available()</code>, and <code>unparsed-text-lines()</code> functions as appropriate (the documents will be found in a local cache and will not involve another request to the server).</p>
</blockquote>
<p>For <code>@http-request</code> it's the possibility to fully specify the HTTP request headers. That's what I have been using so har</p>
<p>The problem is that the approaches cannot be combined. In other words, it is not possible to specify HTTP request headers, load documents asynchronously <em>and</em> pass them to templates that use document()
What could be the solution to this?</p>
<p>Adding more options to <code>ixsl:schedule-action</code> seems like it would overload the instruction too much. I'm thinking a better idea could be decoupling the HTTP client functionality from the document caching functionality. That could be achieved using a new instruction that caches a document node under the specified URI, thus making it available for <code>document()</code> calls.</p>
<p>For example:</p>
<pre><code class="xml syntaxhl" data-language="xml"> <span class="nt"><xsl:variable</span> <span class="na">name=</span><span class="s">"href"</span> <span class="na">select=</span><span class="s">"http://example.com/doc.xml"</span> <span class="na">as=</span><span class="s">"xs:string"</span><span class="nt">/></span>
<span class="nt"><ixsl:schedule-action</span> <span class="na">http-request=</span><span class="s">"map{ 'href': $href }"</span><span class="nt">></span>
<span class="nt"><xsl:call-template</span> <span class="na">name=</span><span class="s">"response-callback"</span><span class="nt">></span>
<span class="nt"><xsl:with-param</span> <span class="na">name=</span><span class="s">"href"</span> <span class="na">select=</span><span class="s">"$href"</span><span class="nt">/></span>
<span class="nt"></xsl:call-template></span>
<span class="nt"></ixsk:schedule-action></span>
<span class="nt"><xsl:template</span> <span class="na">name=</span><span class="s">"response-callback"</span><span class="nt">></span>
<span class="nt"><xsl:param</span> <span class="na">name=</span><span class="s">"href"</span> <span class="na">as=</span><span class="s">"xs:string"</span><span class="nt">/></span>
<span class="nt"><ixsl:cache-doc</span> <span class="na">href=</span><span class="s">"$href"</span> <span class="na">select=</span><span class="s">"?body"</span><span class="nt">/></span>
<span class="nt"><xsl:call-template</span> <span class="na">name=</span><span class="s">"legacy"</span><span class="nt">/></span>
<span class="nt"></xsl:template></span>
<span class="nt"><xsl:template</span> <span class="na">name=</span><span class="s">"legacy"</span><span class="nt">></span>
<span class="nt"><xsl:message</span> <span class="na">select=</span><span class="s">"document('http://example.com/doc.xml')"</span><span class="nt">/></span> <span class="c"><!-- retrieved from cache --></span>
<span class="nt"></xsl:template></span>
</code></pre> SaxonJS - Bug #6346 (New): NPE with replace() on SaxonJS2.6 when exported under 4.0-support condi...https://saxonica.plan.io/issues/63462024-02-14T14:05:50ZJohn Lumleyjohn@saxonica.com
<p>When exporting a stylesheet (either 3.0 or 4.0) for SaxonJS 2.6, using SaxonEE 12.4 running under <code> --allowSyntaxExtensions:on</code>,
a three-argument call on <code>replace()</code> (that is with the fourth <code>$flags</code> argument to default to the empty string), at runtime a null pointer expection is thrown when attempting to retrieve the flags:</p>
<pre><code class="javascript syntaxhl" data-language="javascript"><span class="kd">const</span> <span class="nx">flags</span> <span class="o">=</span> <span class="nx">args</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="p">?</span> <span class="nx">args</span><span class="p">[</span><span class="mi">3</span><span class="p">].</span><span class="nx">next</span><span class="p">().</span><span class="nx">toString</span><span class="p">()</span> <span class="p">:</span> <span class="dl">""</span><span class="p">;</span>
</code></pre>
<p>The <code>next()</code> returns a null.</p>
<p>Without <code>allowSyntaxExtensions</code> or with the fourth argument supplied, the function behaves as expected.</p>
<p>Sample stylesheet, compiled SEF and web page attached</p> SaxonC - Bug #6325 (New): saxonche.PySaxonApiError: Null found in Java string conversation. Line ...https://saxonica.plan.io/issues/63252024-01-19T12:32:10ZO'Neil Delprattoneil@saxonica.com
<p>Reported by user via email.</p>
<p>The user is migrating from saxonpy to saxonche.</p>
<p>Error reported:</p>
<pre><code>saxonche.PySaxonApiError: Null found in Java string conversation. Line number: -1
</code></pre>
<p>You can find the Git repository with the relevant files and code here:</p>
<p><a href="https://github.com/sirisha09-till/xml2dita/tree/main/xml2dita" class="external">https://github.com/sirisha09-till/xml2dita/tree/main/xml2dita</a></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> SaxonJS - Feature #5557 (New): allow clients of SaxonJS to supply a URI resolver functionhttps://saxonica.plan.io/issues/55572022-06-09T23:24:34ZConal Tuohy
<p>SaxonJS doesn't yet allow users to supply their own URI resolver.</p>
<p>Related discussion in XML.com slack instance: <a href="https://xmlcom.slack.com/archives/C011NLXE4DU/p1654568529708119" class="external">https://xmlcom.slack.com/archives/C011NLXE4DU/p1654568529708119</a></p>
<p>I came across the need for such a feature while trying to make resources stored in browser local storage (IndexedDB) available to XSLT running in the browser. I was hoping to be able to supply a resolver that would allow me to handle indexeddb: URIs.</p>
<p>I tried using the browser's "Service Worker" functionality, which can intercept the browser's "fetch" requests, and then either allow them to be handled normally, or else return a promise to fulfill them in some other way. Unfortunately I found that approach is applicable only to URI schemes which the browser already knows about (e.g. http, https, file ...) and also is constrained by some irrelevant security restrictions.</p> SaxonJS - Bug #5540 (New): Namespace context should be reset at the beginning of an XSLT stylesheethttps://saxonica.plan.io/issues/55402022-05-26T08:23:09ZNorm Tovey-Walsh
<p>Martin Honnen <a href="https://saxonica.plan.io/boards/5/topics/8746?pn=1&r=8749#message-8749" class="external">reports</a> that the following transformation works successfully in SaxonJS:</p>
<pre><code><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="3.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
expand-text="yes">
<xsl:template match="/" name="xsl:initial-template">
<xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} {system-property('Q{http://saxon.sf.net/}platform')}</xsl:comment>
<test>{fn:current-dateTime()}</test>
</xsl:template>
</xsl:stylesheet>
</code></pre>
<p>If you run <code>fn:transform()</code> through <code>SaxonJS.XPath.evaluate</code>. Note also that the documentation for <code>XPath.evaluate</code> says "For convenience the usual namespaces for prefixes xml, fn, xs, map, array, math, and saxon are defined by default, but can be overwritten."</p>
<p>It appears that the namespace context of <code>XPath.evaluate</code> "leaks" into the transformation allowing the undeclared use of "fn:".</p> SaxonJS - Bug #5474 (New): Create an ixsl:reset-indexes function?https://saxonica.plan.io/issues/54742022-05-06T14:38:57ZNorm Tovey-Walsh
<p>The reset-indexes API we added to Saxon 2.4 has no convenient ixsl: function that can be called from XSLT. Should we add one in 3.0?</p> SaxonJS - Bug #5144 (New): SaxonJS.XPath.evaluate method fails to select CDATA section node as te...https://saxonica.plan.io/issues/51442021-10-24T11:37:18ZMartin Honnenmartin.honnen@gmx.de
<p>I have run into an odd problem trying to use the Saxon-JS 2.3 browser-side SaxonJS.XPath.evaluate method to select text nodes which are in the original parsed XML marked up as a CDATA section. The native XPath 1.0 implementation of the browser finds them, while Saxon-JS 2 doesn't seem to select them.</p>
<p>Test case is:</p>
<pre><code class="html syntaxhl" data-language="html"><span class="cp"><!DOCTYPE html></span>
<span class="nt"><html</span> <span class="na">lang=</span><span class="s">en</span><span class="nt">></span>
<span class="nt"><head></span>
<span class="nt"><meta</span> <span class="na">charset=</span><span class="s">UTF-8</span><span class="nt">></span>
<span class="nt"><title></span>Saxon-JS 2 CDATA section as text node test<span class="nt"></title></span>
<span class="nt"><script </span><span class="na">src=</span><span class="s">"/Saxon-JS-2.3/SaxonJS2.rt.js"</span><span class="nt">></script></span>
<span class="nt"></head></span>
<span class="nt"><body></span>
<span class="nt"><h1></span>Saxon-JS 2 CDATA section as text node test<span class="nt"></h1></span>
<span class="nt"><section></span>
<span class="nt"><h2></span>XPath tests<span class="nt"></h2></span>
<span class="nt"><script></span>
<span class="kd">const</span> <span class="nx">xmlSample1</span> <span class="o">=</span> <span class="s2">`<root>
<description>description 1<\/description>
<description><![CDATA[<p>description 2]]><\/description>
<\/root>`</span><span class="p">;</span>
<span class="nx">SaxonJS</span><span class="p">.</span><span class="nx">getResource</span><span class="p">({</span> <span class="na">type</span><span class="p">:</span> <span class="dl">'</span><span class="s1">xml</span><span class="dl">'</span><span class="p">,</span> <span class="na">text</span><span class="p">:</span> <span class="nx">xmlSample1</span> <span class="p">})</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">doc</span> <span class="o">=></span> <span class="p">{</span>
<span class="kd">const</span> <span class="nx">textNodes</span> <span class="o">=</span> <span class="nx">SaxonJS</span><span class="p">.</span><span class="nx">XPath</span><span class="p">.</span><span class="nx">evaluate</span><span class="p">(</span><span class="s2">`root/description/text()`</span><span class="p">,</span> <span class="nx">doc</span><span class="p">,</span> <span class="p">{</span> <span class="na">resultForm</span><span class="p">:</span> <span class="dl">'</span><span class="s1">array</span><span class="dl">'</span> <span class="p">});</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">textNodes</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">textNodes</span><span class="p">.</span><span class="nx">length</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">textNodeCount</span> <span class="o">=</span> <span class="nx">SaxonJS</span><span class="p">.</span><span class="nx">XPath</span><span class="p">.</span><span class="nx">evaluate</span><span class="p">(</span><span class="s2">`count(root/description/text())`</span><span class="p">,</span> <span class="nx">doc</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">textNodeCount</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">xpath1TextNodeCount</span> <span class="o">=</span> <span class="nx">doc</span><span class="p">.</span><span class="nx">evaluate</span><span class="p">(</span><span class="s2">`count(root/description/text())`</span><span class="p">,</span> <span class="nx">doc</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">XPathResult</span><span class="p">.</span><span class="nx">NUMBER_TYPE</span><span class="p">).</span><span class="nx">numberValue</span><span class="p">;</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">xpath1TextNodeCount</span><span class="p">);</span>
<span class="p">});</span>
<span class="nt"></script></span>
<span class="nt"></section></span>
<span class="nt"></body></span>
<span class="nt"></html></span>
</code></pre>
<p>Output in the console with Chrome is:</p>
<pre><code>[text]
1
1
2
</code></pre>
<p>Online at <a href="https://martin-honnen.github.io/js/2021/saxon-js-test-cdata-as-text-node1.html" class="external">https://martin-honnen.github.io/js/2021/saxon-js-test-cdata-as-text-node1.html</a>.</p>
<p>On Node.js this doesn't seem to occur.</p> SaxonJS - Feature #5057 (New): Constructing JS objectshttps://saxonica.plan.io/issues/50572021-08-07T09:49:25ZMartynas Jusevicius
<p>Hi. I cannot seem to find a native way to construct JS objects, which makes porting JS code to XSLT complicated. It think it was possible with Saxon-CE, but I might be wrong.</p>
<p>I know there is <code>ixsl:eval()</code>, but since it accepts string as parameter, how does one pass a JS object from a <code>$var</code> for example? It does not seem possible.</p>
<p>So how would I port some simple JS code like the following?</p>
<pre><code class="js syntaxhl" data-language="js"> <span class="kd">var</span> <span class="nx">map</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">ol</span><span class="p">.</span><span class="nb">Map</span><span class="p">({</span>
<span class="na">target</span><span class="p">:</span> <span class="dl">'</span><span class="s1">map</span><span class="dl">'</span><span class="p">,</span>
<span class="na">layers</span><span class="p">:</span> <span class="p">[</span>
<span class="k">new</span> <span class="nx">ol</span><span class="p">.</span><span class="nx">layer</span><span class="p">.</span><span class="nx">Tile</span><span class="p">({</span>
<span class="na">source</span><span class="p">:</span> <span class="k">new</span> <span class="nx">ol</span><span class="p">.</span><span class="nx">source</span><span class="p">.</span><span class="nx">OSM</span><span class="p">()</span>
<span class="p">})</span>
<span class="p">],</span>
<span class="na">view</span><span class="p">:</span> <span class="k">new</span> <span class="nx">ol</span><span class="p">.</span><span class="nx">View</span><span class="p">({</span>
<span class="na">center</span><span class="p">:</span> <span class="nx">ol</span><span class="p">.</span><span class="nx">proj</span><span class="p">.</span><span class="nx">fromLonLat</span><span class="p">([</span><span class="mf">37.41</span><span class="p">,</span> <span class="mf">8.82</span><span class="p">]),</span>
<span class="na">zoom</span><span class="p">:</span> <span class="mi">4</span>
<span class="p">})</span>
<span class="p">});</span>
</code></pre>
<p><a href="https://openlayers.org/en/latest/doc/quickstart.html" class="external">https://openlayers.org/en/latest/doc/quickstart.html</a></p> SaxonJS - Feature #5020 (New): Enable saxon:parse-html in Saxon JS 2 in the browser by using DOMP...https://saxonica.plan.io/issues/50202021-06-08T15:04:28ZMartin Honnenmartin.honnen@gmx.de
<p>Modern browsers support parsing a string of HTML with <code>DOMParser</code> e.g.</p>
<pre><code class="javascript syntaxhl" data-language="javascript"><span class="kd">function</span> <span class="nx">parseHTML</span><span class="p">(</span><span class="nx">html</span><span class="p">)</span> <span class="p">{</span> <span class="k">return</span> <span class="k">new</span> <span class="nx">DOMParser</span><span class="p">().</span><span class="nx">parseFromString</span><span class="p">(</span><span class="nx">html</span><span class="p">,</span> <span class="dl">'</span><span class="s1">text/html</span><span class="dl">'</span><span class="p">);</span> <span class="p">}</span>
</code></pre>
<p>so perhaps the <code>saxon:parse-html</code> extension function from the Java PE and EE world could be mapped in Saxon-JS to a call to some JavaScript similar to the above function.</p> SaxonJS - Feature #4961 (New): use-when in SEF compilation phasehttps://saxonica.plan.io/issues/49612021-04-02T13:17:57ZMartynas Jusevicius
<p><code>ac:uuid</code> is my custom extension function which is obviously not available client-side. But using <code>use-when</code> as follows allowed me to differentiate between function calls on the server and in the browser:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="nt"><xsl:value-of</span> <span class="na">use-when=</span><span class="s">"system-property('xsl:product-name') eq 'Saxon-JS'"</span> <span class="na">select=</span><span class="s">"resolve-uri(concat('/', ixsl:call(ixsl:window(), 'generateUUID', [])), $ac:uri)"</span><span class="nt">/></span>
<span class="nt"><xsl:value-of</span> <span class="na">use-when=</span><span class="s">"system-property('xsl:product-name') = 'SAXON'"</span> <span class="na">select=</span><span class="s">"resolve-uri(concat('/', ac:uuid()), $ac:uri)"</span><span class="nt">/></span>
</code></pre>
<p>That worked fine when compiling SEF with Saxon-JS. Now I'm trying Saxon-EE for that, and a different <code>use-when</code> kicks in and I get an error about the missing <code>ac:uuid</code> function:</p>
<pre><code>Error near {...ve-uri(concat('/', ac:uuid(...} at char 24 in xsl:value-of/@select on line 460 column 175 of default.xsl:
XPST0017 Cannot find a 0-argument function named Q{https://w3id.org/atomgraph/client#}uuid()
Error near {...ac:forClass, $ldt:base) els...} at char 24 in xsl:param/@select on line 230 column 161 of resource.xsl:
XPST0017 Cannot find a 3-argument function named
Q{https://w3id.org/atomgraph/client#}construct-doc()
</code></pre>
<p>Is there a workaround here? Can some property be used to differentiate between compilation and execution phases in <code>use-when</code>?</p> SaxonJS - Bug #4914 (New): Parameters supplied in SaxonJS.transform options not converted correct...https://saxonica.plan.io/issues/49142021-02-18T17:57:50ZDebbie Lockettdebbie@saxonica.com
<p>Using the <code>stylesheetParams</code> option for <code>SaxonJS.transform</code>, strong conversion (as documented at <a href="https://www.saxonica.com/saxon-js/documentation/index.html#!xdm/conversions" class="external">https://www.saxonica.com/saxon-js/documentation/index.html#!xdm/conversions</a>) for a stylesheet parameter with a typed array required type (i.e. which specifies the types of the array members), e.g. <code>array(xs:string)</code> or <code>array(xs:integer)</code>, does not work correctly.</p>
<p>For instance supplying:</p>
<pre><code class="javascript syntaxhl" data-language="javascript"><span class="dl">"</span><span class="s2">stylesheetParams</span><span class="dl">"</span><span class="p">:</span> <span class="p">{</span><span class="dl">"</span><span class="s2">arrayStr</span><span class="dl">"</span><span class="p">:</span> <span class="p">[[</span><span class="dl">"</span><span class="s2">a</span><span class="dl">"</span><span class="p">,</span><span class="dl">"</span><span class="s2">b</span><span class="dl">"</span><span class="p">,</span><span class="dl">"</span><span class="s2">c</span><span class="dl">"</span><span class="p">]]}</span>
</code></pre>
<p>For the stylesheet parameter:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="nt"><xsl:param</span> <span class="na">name=</span><span class="s">"arrayStr"</span> <span class="na">select=</span><span class="s">"['x','y']"</span> <span class="na">as=</span><span class="s">"array(xs:string)"</span><span class="nt">/></span>
</code></pre>
<p>Results in the error:</p>
<pre><code class="text syntaxhl" data-language="text">"Supplied value [xs:untypedAtomic('a'),xs:untypedAtomic('b'),xs:untypedAtomic('c')] does not match required type array(xs:string) in stylesheet parameter Q{}arrayStr"
</code></pre>
<p>It appears that the function conversion rules have not been applied to the array members, so they have not been cast to the required type.</p> SaxonJS - Bug #4829 (New): Static variable initialised to node values cause run-time failurehttps://saxonica.plan.io/issues/48292020-11-18T14:10:54ZJohn Lumleyjohn@saxonica.com
<p>When compiling with the XJ compiler a static variable initialised to a node such as:</p>
<pre><code><xsl:variable name="t" static="yes" select="doc('testStatic.xml')"/>
</code></pre>
<p>where <code>testStatic.xml</code> is:</p>
<pre><code><foo a="1" xmlns:b="BBB" b:attribute="" xmlns="Flibbertygibbet">
<bar/>
</foo>
</code></pre>
<p>the generated package contains a component definition:</p>
<pre><code><co id='0' binds=''>
<globalVariable name='Q{}t' as='1ND' line='7' .... visibility='PRIVATE' flags='s'>
<node kind='9' content='&lt;foo xmlns="Flibbertygibbet" xmlns:b="BBB" a="1" b:attribute=""&gt;&#xA; &lt;bar/&gt;&#xA;&lt;/foo&gt;' baseUri='....testStatic.xml'/>
</globalVariable>
</co>
</code></pre>
<p>that is the serialization of the document is held as the <code>content</code> property of a <code>node</code> instruction, with the <code>kind</code> of the node indicated.</p>
<p>If the selection is <code>doc('testStatic.xml')/(*,*/@*)</code> the compilation becomes:</p>
<pre><code><globalVariable name='Q{}t' as='*N' line='7' ....visibility='PRIVATE' flags='s'>
<literal count='3'>
<node kind='1' content='&lt;foo xmlns="Flibbertygibbet" xmlns:b="BBB" a="1" b:attribute=""&gt;&#xA; &lt;bar/&gt;&#xA;&lt;/foo&gt;' baseUri='..../testStatic.xml'/>
<node kind='2' localName='a' content='1'/>
<node kind='2' localName='attribute' prefix='b' ns='BBB' content=''/>
</literal>
</globalVariable>
</code></pre>
<p>Execution of a reference to this variable in <code>SaxonJS2</code> throws an error as there is currently no support for a <code>node</code> instruction.</p>
<p>There appear to be two routes to solution:</p>
<ol>
<li>Converting the export to a nested set of aleady supported node construction instructions <code>elem</code>, <code>att</code>, <code>text</code> etc, which will be very costly and increase the export size considerably.</li>
<li>Add support for a <code>node</code> instruction, using the implementation code for <code>parse-xml()</code> when necessary</li>
</ol>
<p>The latter seems much more sensible.</p> SaxonJS - Feature #4828 (New): Request support for EXPath file functionshttps://saxonica.plan.io/issues/48282020-11-18T03:05:44ZKurt Cagle
<p>I'm making use specifically of the file:list() function, defined in EXSLT. It compilesand runs properly in Java Saxon but when I attempt to run it in saxon-js, I get the following error:</p>
<p>Static error in XPath in xslt/mfcFunctions.xslt {file:list($testNodes,true())}: Unknown function Q{<a href="http://expath.org/ns/file%7Dlist()" class="external">http://expath.org/ns/file}list()</a></p>
<p>I'm using the namespace:</p>
<p>xmlns:file="<a href="http://expath.org/ns/file" class="external">http://expath.org/ns/file</a>"</p>
<p>Any suggestions?</p>