Re: [xsl] Stylesheet works in oXygen fails in Python with Saxonc

Subject: Re: [xsl] Stylesheet works in oXygen fails in Python with Saxonc
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Jan 2025 22:07:31 -0000
On 21/01/2025 22:58, dvint@xxxxxxxxx wrote:
(base) danvint@mac-PHFW3L52 samples % python3
/Users/danvint/pubsrc/adoc2PDF/_saxon-test.py
SaxonC-HE 12.5 from Saxonica
Error at char 9 in expression in xsl:variable/@select on line 13
column 62 of 02a-build_content-short.xslt:
B  XPDY0002B  Finding root of tree: the context item is absent. Found
while atomizing the
B  first argument of fn:concat() in {((root/nav)/div[xs:string(@class) eq
B  "toc"])/@home-folder[1]} on line 13


You seem to have a global variable or parameter that tries to access the
global context item, so far you have only set the initial-match
selection, use e.g.

B xdm_doc = proc.parse_xml(xml_file_name='nav-short.xml')

and then set both the initial match selection as well as the global
context item to that e.g.

B executable.set_initial_match_selection(xdm_value=xdm_doc)

B executable.set_global_context_item(xdm_item=xdm_doc)


https://www.saxonica.com/saxon-c/doc12/html/saxonc.html#PyXsltExecutable-set_ global_context_item

Current Thread