@@ -382,13 +382,9 @@ private MapType invokeCallFunction() throws XPathException, SaxonApiException {
382
382
} else {
383
383
throw new XPathException (FnTransform .this , ErrorCodes .FOXT0002 , "Error - transform using XSLT 3.0 option initial-function, but the corresponding option function-params was not supplied." );
384
384
}
385
- if (options .deliveryFormat == DeliveryFormat .RAW ) {
386
- final Sequence existValue = Convert .ToExist .of (xslt30Transformer .callFunction (qName , functionParams ));
387
- return makeResultMap (options , existValue , resultDocuments );
388
- } else {
389
- xslt30Transformer .callFunction (qName , functionParams , destination );
390
- return makeResultMap (options , delivery .getDocument (), resultDocuments );
391
- }
385
+
386
+ xslt30Transformer .callFunction (qName , functionParams , destination );
387
+ return makeResultMap (options , delivery , resultDocuments );
392
388
}
393
389
394
390
private MapType invokeCallTemplate () throws XPathException , SaxonApiException {
@@ -398,20 +394,14 @@ private MapType invokeCallTemplate() throws XPathException, SaxonApiException {
398
394
"AND " + INITIAL_TEMPLATE .name + " supplied indicating call-template invocation." );
399
395
}
400
396
401
- final QName qName = options .initialTemplate .get ().getQName ();
402
397
//TODO (AP) - Implement complete conversion in the {@link Convert} class
403
398
//TODO (AP) - The saxDestination conversion loses type information in some cases
404
399
//TODO (AP) - e.g. fn-transform-63 from XQTS has a <xsl:template name='main' as='xs:integer'>
405
400
//TODO (AP) - which alongside "delivery-format":"raw" fails to deliver an int
406
- if (options .deliveryFormat == DeliveryFormat .RAW ) {
407
- final Sequence existValue = Convert .ToExist .of (xslt30Transformer .callTemplate (Convert .ToSaxon .of (qName )));
408
- return makeResultMap (options , existValue , resultDocuments );
409
- } else {
410
- //TODO (AP) - The saxDestination conversion loses type information in some cases
411
- //TODO (AP) - e.g. fn-transform-63 from XQTS has a <xsl:template name='main' as='xs:integer'>
412
- xslt30Transformer .callTemplate (Convert .ToSaxon .of (qName ), destination );
413
- return makeResultMap (options , delivery , resultDocuments );
414
- }
401
+
402
+ final QName qName = options .initialTemplate .get ().getQName ();
403
+ xslt30Transformer .callTemplate (Convert .ToSaxon .of (qName ), destination );
404
+ return makeResultMap (options , delivery , resultDocuments );
415
405
}
416
406
417
407
private MapType invokeApplyTemplates () throws XPathException , SaxonApiException {
@@ -420,25 +410,12 @@ private MapType invokeApplyTemplates() throws XPathException, SaxonApiException
420
410
final Item item = initialMatchSelection .itemAt (0 );
421
411
if (item instanceof Document ) {
422
412
final Source sourceIMS = new DOMSource ((Document )item , context .getBaseURI ().getStringValue ());
423
- if (options .deliveryFormat == DeliveryFormat .RAW ) {
424
- final Sequence existValue = Convert .ToExist .of (xslt30Transformer .applyTemplates (sourceIMS ));
425
- return makeResultMap (options , existValue , resultDocuments );
426
- }
427
413
xslt30Transformer .applyTemplates (sourceIMS , destination );
428
414
} else {
429
415
final XdmValue selection = toSaxon .of (initialMatchSelection );
430
- if (options .deliveryFormat == DeliveryFormat .RAW ) {
431
- final Sequence existValue = Convert .ToExist .of (xslt30Transformer .applyTemplates (selection ));
432
- return makeResultMap (options , existValue , resultDocuments );
433
- }
434
416
xslt30Transformer .applyTemplates (selection , destination );
435
417
}
436
418
} else if (sourceNode .isPresent ()) {
437
- if (options .deliveryFormat == DeliveryFormat .RAW ) {
438
- xslt30Transformer .applyTemplates (sourceNode .get (), destination );
439
- final Sequence existValue = Convert .ToExist .of (delivery .getXdmValue ());
440
- return makeResultMap (options , existValue , resultDocuments );
441
- }
442
419
xslt30Transformer .applyTemplates (sourceNode .get (), destination );
443
420
} else {
444
421
throw new XPathException (FnTransform .this ,
@@ -552,27 +529,6 @@ private MapType makeResultMap(final Options options, final Delivery delivery, fi
552
529
return outputMap ;
553
530
}
554
531
555
- private MapType makeResultMap (final Options options , final Sequence rawPrimaryOutput , final Map <URI , Delivery > resultDocuments ) throws XPathException {
556
-
557
- final MapType outputMap = new MapType (context );
558
- final AtomicValue outputKey ;
559
- if (options .baseOutputURI .isPresent ()) {
560
- outputKey = options .baseOutputURI .get ();
561
- } else {
562
- outputKey = new StringValue ("output" );
563
- }
564
-
565
- outputMap .add (outputKey , postProcess (outputKey , rawPrimaryOutput , options .postProcess ));
566
-
567
- for (final Map .Entry <URI , Delivery > resultDocument : resultDocuments .entrySet ()) {
568
- final AnyURIValue key = new AnyURIValue (resultDocument .getKey ());
569
- final Sequence value = postProcess (key , convertToDeliveryFormat (options , resultDocument .getValue ()), options .postProcess );
570
- outputMap .add (key , value );
571
- }
572
-
573
- return outputMap ;
574
- }
575
-
576
532
private Sequence postProcess (final AtomicValue key , final Sequence before , final Optional <FunctionReference > postProcessingFunction ) throws XPathException {
577
533
if (postProcessingFunction .isPresent ()) {
578
534
FunctionReference functionReference = postProcessingFunction .get ();
0 commit comments