…always good to wait and see what happens ;·)


Von: Nico Kutscherauer via BaseX-Talk
Gesendet: Donnerstag, 26. Februar 2026 14:04
Bis: basex-talk@mailman.uni-konstanz.de
Betreff: [basex-talk] Re: Very suprising results by combining BaseX, Saxon, XSLT-Packages and a custom Saxon-Initializer

Hi,

Sorry, forget it! I was able to reproduce it with Saxon alone. And it is a problem with my 
initialiser – but with a strange reaction from Saxon to it.

I've created a Saxon ticket for this:
 https://saxonica.plan.io/issues/7032


Best Regards and once again, sorry for the false alert!
Nico



Am 25.02.2026 um 18:38 schrieb Nico Kutscherauer:
Hi BaseX team,

I admit, I'm pushing the combinations a bit, but otherwise it wouldn't be any fun... ;-)

I want to call an XSLT stylesheet with Saxon in BaseX. However, the stylesheet should 
use an XSLT package. For XSLT packages, I wrote a Saxon initialiser some time ago that 
automatically recognises packages in the classpath and configures Saxon so that they 
are available.

When embedding it in BaseX, however, I now encounter very strange behaviour when I 
execute the stylesheet twice (or more) in the same session. I have reproduced this 
in this GitHub project:

https://github.com/nkutsche/basex-saxon-xslt-package-issue

When you run either the shell script basex or basex.bat in the project, the following 
happens:

1. The Maven project fetches the necessary dependencies.
   - Saxon 12.9 & BaseX 12.2
   - xpath-model - the XSLT package I want to use in my XSLTs 
     (https://github.com/nkutsche/xpath-model/)
   - xslt-pkg-manager120 - the Saxon initialiser mentioned above
2. The system property SAXON_INITIALIZER is set to the Saxon initialiser
3. The XQuery script xquer.xq is executed with BaseX:
   - this executes test.xsl twice on test.xml with xslt:transform()
   - the sequence of both transformation results is the result of the main query.
4. test.xsl uses a function from the XPath model: the XPath expression in test.xml is 
   parsed into an XML tree.

The second result is then very surprising:

---- result 1 ----
<expr><operation type="step"><slash/><arg><locationStep axis="child"><nodeTest kind="node"/><predicate><integer value="1"/></predicate></locationStep></arg><slash/><arg><locationStep axis="child"><nodeTest kind="node"/><predicate><integer value="4"/></predicate></locationStep></arg></operation></expr>
---- result 2 ----
<expr><XPath><Expr Predicate="sequence"><EOF><ExprSingle><Expr Predicate="or"><EOF><Expr Predicate="and"><EOF><ComparisonExpr><Expr Predicate="concat"><EOF><Expr Predicate="range"><EOF><Expr Predicate="additive"><EOF><Expr Predicate="multiplicativ"><EOF><Expr Predicate="union"><EOF><Expr Predicate="intersect-except"><EOF><Expr Predicate="instance-of"><EOF><Expr Predicate="treat-as"><EOF><Expr Predicate="castable"><EOF><Expr Predicate="cast"><EOF><Expr Predicate="arrow"><EOF><Expr Predicate="unary"><EOF><ValueExpr><Expr Predicate="map"><EOF><Expr Predicate="step"><EOF><TOKEN>/</TOKEN></EOF><EOF><Expr Predicate="step"><EOF>[...]

The complete output can also be found here:

https://github.com/nkutsche/basex-saxon-xslt-package-issue/actions/runs/22407282705/job/64870585894#step:4:1823

The first result is as expected. I can hardly explain the second one. Except that the 
elements look similar to my intermediate results, but as far as I know, they never occur 
in this combination. My only guess is that a few templates in the package suddenly are 
no longer matching or no longer match as they should.

Do you have any idea where this might be coming from? I couldn't reproduce the behaviour 
when I called Saxon directly twice in a JVM. The problem could still be in Saxon, of 
course, but I would first have to reproduce it without BaseX.

Thank you for your help!

Best Regards,
Nico



--

Nico Kutscherauer
XML Developer

data2type GmbH
Im Breitspiel 6A
69126 Heidelberg

Tel.: +49-(0)6221-73 912 60

www.data2type.de

Workingdays: Tue/Wed/Thu/Fri(HO)
Workinghours: 10-18.30

Company’s head office: Heidelberg
Commercial Register court: AG Mannheim HRB 715195
CEO: Manuel Montero Pineda