Project

Profile

Help

Bug #6449

closed

System.AggregateException in SaxonCS (12.4) when using collection function to pull a collection catalog file over HTTP(S)

Added by Martin Honnen 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
External resources
Sprint/Milestone:
-
Start date:
2024-06-10
Due date:
% Done:

100%

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

Description

I have an example XSLT 3 stylesheet

<?xml version="1.0" encoding="utf-8"?>
<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:output method="xml" indent="yes"/>

  <xsl:template name="xsl:initial-template">
    <result>
      <xsl:copy-of select="collection('https://martin-honnen.github.io/xslt/2023/collection-example1.xml')"/>
      <xsl:comment>Run with {system-property('xsl:product-name')} {system-property('xsl:product-version')} at {current-dateTime()}</xsl:comment>
    </result>
  </xsl:template>

</xsl:stylesheet>

which works fine in Saxon HE 12.4 and SaxonC HE 12.4.2 from the command line (-it) but throws an error (System.AggregateException) for SaxonCS 12.4:

PS C:\Users\marti\OneDrive\Documents\xslt\blog-xslt-3-by-example\collection-test1> & 'C:\Program Files\Saxonica\SaxonCS-12.4\SaxonCS.exe' transform -it -xsl:.\collection-catalog-test2.xsl
System.AggregateException: One or more errors occurred. (https://martin-honnen.github.io/xslt/2023/collection-file1.xml)
 ---> System.Exception: https://martin-honnen.github.io/xslt/2023/collection-file1.xml
   at Saxon.Impl.Helpers.UriUtils.ToURL(Uri uri)
   at Saxon.Hej.resource.AbstractResourceCollection.getInputDetails(String resourceURI)
   at Saxon.Hej.resource.CatalogCollection.<>c__DisplayClass4_0.<getResources>b__0(String input)
   at Saxon.Impl.Overrides.MappingEnumerator`2.get_Current()
   at Saxon.Hej.functions.CollectionFn.CollectionIterator.next()
   at Saxon.Impl.Parallel.MultithreadedItemMappingIterator.InputAsEnumerable(SequenceIterator iter)+MoveNext()
   at System.Collections.Concurrent.Partitioner.DynamicPartitionerForIEnumerable`1.InternalPartitionEnumerable.GrabChunk_Single(KeyValuePair`2[] destArray, Int32 requestedChunkSize, Int32& actualNumElementsGrabbed)
   at System.Collections.Concurrent.Partitioner.DynamicPartitionerForIEnumerable`1.InternalPartitionEnumerator.GrabNextChunk(Int32 requestedChunkSize)
   at System.Collections.Concurrent.Partitioner.DynamicPartitionEnumerator_Abstract`2.MoveNext()
   at System.Linq.Parallel.PartitionerQueryOperator`1.OrderablePartitionerEnumerator.MoveNext(TElement& currentElement, Int32& currentKey)
   at System.Linq.Parallel.SelectQueryOperator`2.SelectQueryOperatorEnumerator`1.MoveNext(TOutput& currentElement, TKey& currentKey)
   at System.Linq.Parallel.OrderPreservingPipeliningSpoolingTask`2.SpoolingWork()
   at System.Linq.Parallel.SpoolingTaskBase.Work()
   at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
   at System.Linq.Parallel.QueryTask.<>c.<.cctor>b__10_0(Object o)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
   at System.Linq.Parallel.OrderPreservingPipeliningMergeHelper`2.OrderedPipeliningMergeEnumerator.ThrowIfInTearDown()
   at System.Linq.Parallel.OrderPreservingPipeliningMergeHelper`2.OrderedPipeliningMergeEnumerator.MoveNext()
   at System.Linq.Parallel.QueryOpeningEnumerator`1.MoveNext()
   at Saxon.Impl.Parallel.MultithreadedItemMappingIterator.next()
   at Saxon.Hej.value.SequenceExtent.from(SequenceIterator iter)
   at Saxon.Hej.om.SequenceTool.toGroundedValue(SequenceIterator iterator)
   at Saxon.Hej.functions.CollectionFn.call(XPathContext context, Sequence[] arguments)
   at Saxon.Hej.expr.SystemFunctionCall.SystemFunctionCallElaborator.<>c__DisplayClass1_0.<elaborateForPull>b__1(XPathContext context)
   at Saxon.Hej.expr.instruct.CopyOf.CopyOfElaborator.<>c__DisplayClass2_4.<elaborateForPush>b__3(Outputter output, XPathContext context)
   at Saxon.Hej.expr.instruct.Block.BlockElaborator.<>c__DisplayClass3_1.<elaborateForPush>b__1(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.FixedElement.FixedElementElaborator.<>c__DisplayClass0_0.<elaborateForPush>b__0(Outputter out, XPathContext context)
   at Saxon.Hej.expr.instruct.NamedTemplate.expand(Outputter output, XPathContext context)
   at Saxon.Hej.trans.XsltController.callTemplate(StructuredQName initialTemplateName, Receiver out)
   at Saxon.Hej.s9api.Xslt30Transformer.callTemplate(QName templateName, Destination destination)
   at Saxon.Hej.Transform.processFile(Source source, XsltExecutable sheet, File outputFile, CommandLineOptions options)
   at Saxon.Hej.Transform.doTransform(String[] args)
Fatal error during transformation: AggregateException: One or more errors occurred. (https://martin-honnen.github.io/xslt/2023/collection-file1.xml)
Exiting with code 2

Example output with SaxonC is e.g

<?xml version="1.0" encoding="UTF-8"?>
<result>
   <example>example 1</example>
   <example>example 2</example>
   <!--Run with SAXON HE 12.4.2 at 2024-06-10T21:51:18.3941897+02:00-->
</result>

I have for the time being used "category: command line" as it is there where I see it but I guess it is an error in the collection handling of SaxonCS.

Please register to edit this issue

Also available in: Atom PDF