Page 1 of 1

Is there a way using XSLT Packages in Schematron

Posted: Fri Mar 08, 2024 2:06 pm
by nkutsche
Hi,

I'm working more and more with XSLT packages. Now I have a first case where I would like to reuse one in a Schematron schema.

Is there a way to do this? In Schematron it would look like this:

Code: Select all

<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
    xmlns:sqf="http://www.schematron-quickfix.com/validator/process" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    queryBinding="xslt3">
    <xsl:use-package package-version="*" name="http://www.nkutsche.com/my-special-xslt-module"/>
A standard Schematron implementation should be able to handle this. As far as I can see the only thing to do for the environment would be to enable a custom Saxon config for Schematron validations or a custom Saxon initializer class to provide the package resources. I haven't found a way to do this in Oxygen 26. Have I missed something?

Best Regards,
Nico

Re: Is there a way using XSLT Packages in Schematron

Posted: Fri Mar 08, 2024 5:42 pm
by tavy
Hi Nico,

Thanks for the feedback,
Unfortunately, we do not support XSLT packages in Schematron. I added an issue on our issue tracker to implement this support in a future version

Best Regards,
Octavian

Re: Is there a way using XSLT Packages in Schematron

Posted: Mon Mar 11, 2024 1:53 pm
by nkutsche
Hi Octavian,
thanks for the response! Meanwhile I found a workaround which meets maybe not all needs of the package subject, but for my planned show case it works.
You can use the transform function of XSLT 3. Saxon allows to provide a custom Saxon config file via the vendor-options field:
See https://www.saxonica.com/html/documenta ... sform.html

My solution looks like this now:

Code: Select all

<sch:let name="config" value="doc('saxon-config.xml')"/>
<sch:let name="xmlml-function" value="
        function($name as xs:string, $args as array(*)){
            transform(map{ 
                    'vendor-options': map {QName('http://saxon.sf.net/', 'configuration'): $config},
                    'package-name' : 'http://www.nkutsche.com/xmlml',
                    'initial-function' : QName($xmlmlns, $name),
                    'function-params' : $args,
                    'delivery-format' : 'raw',
                    'package-version' : '*'
                })?output
            }
        "/>
<sch:let name="xmlml-doc" value="$xmlml-function('parse', [base-uri(/)])"/>
Best Regards,
Nico