Project

Profile

Help

Bug #6227

closed

document-uri() not working when using collection()

Added by Daniel Haley about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Start date:
2023-10-18
Due date:
% Done:

0%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
Fixed in version:
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

I'm using saxonche version 12.3.0 installed using pip.

When using collection() in XSLT, document-uri() doesn't seem to be working.

I've created a small test and have attached a zip containing the Python, XSLT, and input files.

Python (using version 3.11.5)

import saxonche

with saxonche.PySaxonProcessor(license=False) as proc:
    xsltproc = proc.new_xslt30_processor()
    executable = xsltproc.compile_stylesheet(stylesheet_file="test.xsl")
    content = executable.call_template_returning_string()

    print(f"\ncontent:\n{content}")

XSLT 3.0

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" expand-text="yes">
    <xsl:output indent="yes" omit-xml-declaration="yes"/>
    <xsl:strip-space elements="*"/>
        
    <xsl:template name="xsl:initial-template">
        <xsl:for-each select="collection('input?select=*.(xml|XML)&amp;content-type=application/xml')">
            <xsl:message>Processing "{document-uri()}"...</xsl:message>
            <xsl:copy-of select="."/>
        </xsl:for-each>
    </xsl:template>
    
</xsl:stylesheet>

Output

Processing ""...
Processing ""...
Processing ""...

content:
<doc>First test XML instance.</doc>
<doc>Second test XML instance.</doc>
<doc>Third test XML instance.</doc>

The document URI is not in the "Processing" messages.


Files

test_saxonche_collection.zip (1.42 KB) test_saxonche_collection.zip Daniel Haley, 2023-10-19 01:05

Please register to edit this issue

Also available in: Atom PDF