Saxonica Developer Community: Issueshttps://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2022-05-06T14:38:57ZSaxonica Developer Community
Planio 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> 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> SaxonJS - Support #5225 (New): While using xslt 3.0 function "xml-to-json" would like to avoid es...https://saxonica.plan.io/issues/52252022-01-24T10:51:15ZJuhi Gupta
<p>We are trying to convert xml to json, while using function "xml-to-json" it is trying to escape '/' by adding '' before it. We would like to avoid doing that and translate as is.</p>
<pre><code class="xml syntaxhl" data-language="xml">
<span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<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">xmlns=</span><span class="s">"http://www.w3.org/2005/xpath-functions"</span>
<span class="na">xmlns:func=</span><span class="s">"http://ingka.ikea.com/"</span>
<span class="na">xmlns:xs=</span><span class="s">"http://www.w3.org/2001/XMLSchema"</span>
<span class="na">version=</span><span class="s">"3.0"</span><span class="nt">></span>
<span class="nt"><xsl:output</span> <span class="na">method=</span><span class="s">"text"</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"><xsl:variable</span> <span class="na">name=</span><span class="s">"transformed-xml"</span><span class="nt">></span>
<span class="nt"><xsl:call-template</span> <span class="na">name=</span><span class="s">"SamplBody"</span> <span class="nt">/></span>
<span class="nt"><xsl:copy-of</span> <span class="na">select=</span><span class="s">"/map"</span><span class="nt">/></span>
<span class="nt"></xsl:variable></span>
<span class="nt"><xsl:value-of</span> <span class="na">select=</span><span class="s">"xml-to-json($transformed-xml, map { 'indent' : true() })"</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">"SamplBody"</span> <span class="nt">></span>
<span class="nt"><map></span>
<span class="nt"><string</span> <span class="na">key=</span><span class="s">"SamplString"</span><span class="nt">></span>n/a<span class="nt"></string></span>
<span class="nt"></map></span>
<span class="nt"></xsl:template></span>
<span class="nt"></xsl:stylesheet></span>
</code></pre>
<p>and the result of this xslt is</p>
<pre><code class="json syntaxhl" data-language="json"><span class="w">
</span><span class="p">{</span><span class="w"> </span><span class="nl">"SamplString"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"n</span><span class="se">\/</span><span class="s2">a"</span><span class="w"> </span><span class="p">}</span><span class="w">
</span></code></pre>
<p>We would like the result to look like</p>
<pre><code class="json syntaxhl" data-language="json"><span class="w">
</span><span class="p">{</span><span class="w"> </span><span class="nl">"SamplString"</span><span class="w"> </span><span class="p">:</span><span class="w"> </span><span class="s2">"n/a"</span><span class="w"> </span><span class="p">}</span><span class="w">
</span></code></pre>
<p>Can you suggest a solution for this?</p> SaxonJS - Bug #5199 (New): Multi-valued request/response headershttps://saxonica.plan.io/issues/51992022-01-08T23:08:52ZMartynas Jusevicius
<p>Looks like multi-values are not supported in 2.3 because <code>headers</code> type is <code>map(xs:string, xs:string)</code>.
<a href="https://www.saxonica.com/saxon-js/documentation2/index.html#!development/http" class="external">https://www.saxonica.com/saxon-js/documentation2/index.html#!development/http</a></p>
<p>Maybe the type should be <code> map(xs:string, xs:string*)</code>?</p>
<p>A similar issue to the URL param parsing: <a href="https://stackoverflow.com/questions/68944773/parsing-a-url-query-string-into-a-map-of-parameters-with-xpath" class="external">https://stackoverflow.com/questions/68944773/parsing-a-url-query-string-into-a-map-of-parameters-with-xpath</a></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 #5142 (New): New <ixsl:add-listener> instructionhttps://saxonica.plan.io/issues/51422021-10-23T20:38:27ZMartynas Jusevicius
<p>Hi. I think there is a generic use case that shows up especially when integrating Saxon-JS with JS libraries. For example, with Google Maps one needs to use this to add an <code>onlick</code> listener for a marker:</p>
<pre><code> marker.addListener("click", () => {
infowindow.open({
anchor: marker,
map,
shouldFocus: false,
});
});
</code></pre>
<p>It requires a JS callback function, which is anonymous <code>()</code> in this case. I would like to use IXSL to handle the marker <code>onclick</code> event instead.</p>
<p>The native IXSL way would be:</p>
<pre><code><xsl:template match="a[@class = 'marker']" mode="ixsl:onclick">
</code></pre>
<p>but the problem is that the DOM generated by Google Maps, including marker IDs or class names, cannot be relied upon. So the match pattern approach does not really work.</p>
<p>I propose a second, generalized mechanism to handle events using a new extension instruction <code><ixsl:add-listener></code>. It could be used like this:</p>
<pre><code><ixsl:add-listener name="click" object="$marker">
<xsl:call-template name="onMarkerClick"/>
</ixsl:add-listener>
<xsl:template name="onMarkerClick" mode="ixsl:onclick">
<xsl:variable name="event" select="ixsl:event()"/> <!-- MapMouseEvent -->
<xsl:variable name="lat-lng" select="ixsl:get(ixsl:event(), 'latLng')"/>
...
</xsl:template>
</code></pre>
<p>If the native <code>match</code>/<code>mode</code>/ approach can be used instead, one could replace the <code>name="onMarkerClick"</code> with <code>mode="ixsl:onclick"</code> and the same template body should still work.</p>
<p>The <code><ixsl:add-listener></code> call would translate to this pseudo-JS:</p>
<pre><code>marker.addListener('click', (event) => { SaxonJS.callTemplate('onMarkerClick', event); });
</code></pre> 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 #5011 (New): Bundle browser version in NPM packagehttps://saxonica.plan.io/issues/50112021-05-28T14:01:48ZDaniel Naab
<p>Is there any possibility of distributing the browser version of Saxon-JS in the NPM module?</p>
<p>For context, the package.json may include a <code>browser</code> attribute, that specifies a browser package that web bundlers may use when the library is imported. <a href="https://docs.npmjs.com/cli/v7/configuring-npm/package-json#browser" class="external">https://docs.npmjs.com/cli/v7/configuring-npm/package-json#browser</a></p>
<p>Additionally, a <code>module</code> attribute may specify an ESM module.</p>
<p>Including the browser bundle in the NPM package would ease dependency management, and facilitate library usage in applications with both node.js and browser-based components.</p> SaxonJS - Bug #5001 (New): saxon-js xsl:output method "xml" with indent "yes" eats whitespacehttps://saxonica.plan.io/issues/50012021-05-25T19:49:34ZJamie Peabody
<p>Using saxon-js 2.2.0, and given XSLT:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><xsl:stylesheet</span> <span class="na">version=</span><span class="s">"2.0"</span>
<span class="na">exclude-result-prefixes=</span><span class="s">"xs"</span>
<span class="na">xmlns:xsl=</span><span class="s">"http://www.w3.org/1999/XSL/Transform"</span>
<span class="na">xmlns:xs=</span><span class="s">"http://www.w3.org/2001/XMLSchema"</span><span class="nt">></span>
<span class="nt"><xsl:output</span> <span class="na">method=</span><span class="s">"xml"</span> <span class="na">indent=</span><span class="s">"yes"</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"><login></span>
<span class="nt"><xsl:value-of</span> <span class="na">select=</span><span class="s">"/data/text()"</span><span class="nt">/></span>
<span class="nt"></login></span>
<span class="nt"></xsl:template></span>
<span class="nt"></xsl:stylesheet></span>
</code></pre>
<p>And XML:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><data></span> <span class="nt"></data></span>
</code></pre>
<p>saxon-js produces:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><login/></span>
</code></pre>
<p>If <code>indent="no"</code>, then it outputs:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><login></span> <span class="nt"></login></span>
</code></pre>
<p>It is unexpected that changing indentation would cause whitespace to be consumed and for elements to collapse.</p> SaxonJS - Feature #4991 (New): Do indentation of JSON with xml-to-json($json-xml, map { 'indent' ...https://saxonica.plan.io/issues/49912021-05-16T08:17:31ZMartin Honnenmartin.honnen@gmx.de
<p>The function <code>xml-to-json</code> takes an optional second argument with a map for options, the one being defined is a boolean value for the key <code>indent</code>.</p>
<p>While the Java and .NET product honour that option and do indent any produced JSON, Saxon-JS 2 doesn't do any indentation, see also <a href="https://saxonica.plan.io/boards/5/topics/8052?r=8053#message-8053" class="external">https://saxonica.plan.io/boards/5/topics/8052?r=8053#message-8053</a>.</p>
<p>It would be nice if the implementation could be enhanced to support indentation as otherwise reading the result of <code>xml-to-json</code> that Saxon-JS 2 produces is very hard as you are faced with one long line of JSON data.</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 #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> SaxonJS - Support #4809 (New): How to use collections in Saxon-JS?https://saxonica.plan.io/issues/48092020-10-26T21:19:33ZJerry Jackson
<p>I have a very simple stylesheet:</p>
<pre><code class="xml syntaxhl" data-language="xml"><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<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">name=</span><span class="s">"xsl:initial-template"</span><span class="nt">></span>
<span class="nt"><xsl:apply-templates</span> <span class="na">select=</span><span class="s">"collection('file:/C:/temp/mydir')"</span><span class="nt">/></span>
<span class="nt"></xsl:template></span>
<span class="nt"></xsl:stylesheet></span>
</code></pre>
<p>When I run this with Saxon-JS on the command-line (xslt3 "-xsl:test.xsl"), I get this error:</p>
<pre><code>Transformation failure: Error FODC0002 at test.xsl#4
Unknown collection (no collectionFinder supplied)
Transformation failed: Error FODC0002 at test.xsl#4
Unknown collection (no collectionFinder supplied)
</code></pre>
<p>I have tried to run it with the API, and reading the documentation I see I can supply a collectionFinder in the transform method, but i'm not sure on how to implement it to get the same result as when running it in Saxon-Java.</p>