Saxonica Developer Community: Issueshttps://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2024-02-20T15:42:25ZSaxonica Developer Community
Planio 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 - Feature #6303 (New): `xsl:result-document` method that replaces `outerHTML`https://saxonica.plan.io/issues/63032023-12-22T10:53:55ZMartynas Jusevicius
<p>Currently <code><xsl:result-document method="ixsl:replace-content"></code> replaces the equivalent of <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML" class="external"><code>innerHTML</code></a>.</p>
<p>Therefore I often find myself doing stuff like this:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="nt"><xsl:variable</span> <span class="na">name=</span><span class="s">"row"</span> <span class="na">as=</span><span class="s">"node()*"</span><span class="nt">></span>
<span class="nt"><xsl:apply-templates</span> <span class="na">select=</span><span class="s">"$resource"</span> <span class="na">mode=</span><span class="s">"bs2:Row"</span><span class="nt">/></span>
<span class="nt"></xsl:variable></span>
<span class="nt"><xsl:result-document</span> <span class="na">href=</span><span class="s">"?."</span> <span class="na">method=</span><span class="s">"ixsl:replace-content"</span><span class="nt">></span>
<span class="nt"><xsl:copy-of</span> <span class="na">select=</span><span class="s">"$row/*"</span><span class="nt">/></span>
<span class="nt"></xsl:result-document></span>
</code></pre>
<p>Whereas it would be much more convenient to have a new method such as <code>ixsl:replace-self</code> that would replace <a href="https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML" class="external"><code>outerHTML</code></a>. My example would look much simpler then:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="nt"><xsl:result-document</span> <span class="na">href=</span><span class="s">"?."</span> <span class="na">method=</span><span class="s">"ixsl:replace-self"</span><span class="nt">></span>
<span class="nt"><xsl:apply-templates</span> <span class="na">select=</span><span class="s">"$resource"</span> <span class="na">mode=</span><span class="s">"bs2:Row"</span><span class="nt">/></span>
<span class="nt"></xsl:result-document></span>
</code></pre> SaxonJS - Bug #6298 (New): base-uri() value does not update together with DOMhttps://saxonica.plan.io/issues/62982023-12-19T23:34:51ZMartynas Jusevicius
<p>My SaxonJS code replaces large chunks of DOM with content loaded from different documents. DOM's baseURI property returns the source document's URL, but <code>base-uri()</code> does not always seem to do that. Which can lead to a stale value, probably because the DOM is updated?</p>
<p>This is my observation of the discrepancy:</p>
<pre><code>ixsl:get(., 'baseURI'): https://localhost:4443/7b386331-5a82-46ab-820b-38df78a91456/ SaxonJS2.rt.js:785:84
base-uri(): https://localhost:4443/ SaxonJS2.rt.js:785:84
ixsl:location(): https://localhost:4443/7b386331-5a82-46ab-820b-38df78a91456/
</code></pre> SaxonJS - Bug #6245 (New): broken links in SaxonJS documentation https://saxonica.plan.io/issues/62452023-11-08T14:13:28ZMartin Honnenmartin.honnen@gmx.de
<p><a href="https://www.saxonica.com/saxon-js/documentation2/index.html#!conformance/xslt30" class="external">https://www.saxonica.com/saxon-js/documentation2/index.html#!conformance/xslt30</a> has (at least) two not working links, in the row for <code>vendor-options</code> it says</p>
<blockquote>
<p>Enables syntax extensions for XSLT and XPath, specifically the conditional XSLT extensions described here and the XPath otherwise operator</p>
</blockquote>
<p>where</p>
<ol>
<li>"conditional XSLT extensions described here" links to <a href="https://www.saxonica.com/documentation12/index.html#!extensions/xslt-syntax-extensions" class="external">https://www.saxonica.com/documentation12/index.html#!extensions/xslt-syntax-extensions</a> which gives the error "Error in URI hash-path: Section 'xslt-syntax-extensions' not found in path: extensions/xslt-syntax-extensions"</li>
<li>"otherwise" links to <a href="https://www.saxonica.com/documentation12/index.html#!extensions/syntax-extensions/otherwise" class="external">https://www.saxonica.com/documentation12/index.html#!extensions/syntax-extensions/otherwise</a> which gives a similar error "Error in URI hash-path: Section 'syntax-extensions' not found in path: extensions/syntax-extensions/otherwise"</li>
</ol> 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> 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>