Project

Profile

Help

Bug #5027

closed

setting xslt parameter from python/saxon-c

Added by Lou Burnard over 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2021-06-25
Due date:
% Done:

100%

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

Description

I am having difficulty setting a parameter in my XSLT stylesheet from Python. At the command line, I would write

$saxon [inputXML] [stylesheet] param=value

to supply a value for the <xsl:param name='param'/> at the start of my stylesheet. Using Saxon/C 1.2.1 running with Saxon-HE 9.9.1.5C I write

   FILE="input.XML"
   SCRIPT="stylesheet.xsl"
   VALUE="value"
        x = proc.new_xslt30_processor()
        x.set_result_as_raw_value(True)
        x.set_initial_match_selection(file_name=FILE)
        x.set_parameter(param,VALUE)
        result = x.apply_templates_returning_string(stylesheet_file=script)

(where the uppercase names are Python variables)

But this doesn't work: I get "nameError: name 'param' is not defined."

I am a beginner here so forgive me if this is obvious! I could not find any examples showing this kind of (fairly common) usage in https://www.saxonica.com/saxon-c/doc/html/saxonc.html

Please register to edit this issue

Also available in: Atom PDF