This is a different question but related to the code in the previous. I
thought I was passing parameter values to the stylesheet correctly, but
I just tried changing a value and I found that it isn't doing what I
expect.
I've confirmed that the Python parts for passing and changing the
parameter are correct, it isn't reaching the stylesheet. Note that
previously I was using these stylesheets and call java at the command
line and that process was working. Here is the Python
def run_saxon_py(input_file, xslt_file, output_file=None,
TRYREQUEST=None, DEBUG=None):
time_to_wait = 10
time_counter = 0
while not os.path.exists(input_file):
time.sleep(2)
time_counter += 2
print(f"WARNING: Waiting for \"{input_file}\" to exist to apply
\"{xslt_file}\".")
if time_counter > time_to_wait:break
try:
with PySaxonProcessor(license=False) as proc:
xsltproc = proc.new_xslt30_processor()
executable =
xsltproc.compile_stylesheet(stylesheet_file=xslt_file)
if DEBUG == 'yes':
executable.set_parameter('DEBUG',
proc.make_string_value('yes'))
if TRYREQUEST == 'yes':
executable.set_parameter('P1_CONTENT',
proc.make_string_value('yes'))
if output_file == None:
messages =
executable.transform_to_value(source_file=input_file)
print(messages)
else:
# Perform the transformation and write the output
directly to a file
result_file = xsltproc.transform_to_file(
source_file=input_file,
stylesheet_file=xslt_file,
output_file=output_file
)
# print(f"Transformation complete. Output saved to:
{result_file}")
except Exception as e:
print(f"ERROR: Unable to apply \"{xslt_file}\" to
\"{input_file}\": \n{e}\n")
TRYREQUEST is the value I'm trying to change. I'm setting it to yes, but
instead of getting that value, my default definition of no is not
changing.
Parameter setting:
<xsl:param name="P1_CONTENT" select="'no'"/> <!-- P1 collections uses
Try Request -->
I added a message in the template where this matters
<xsl:template match="partial" mode="partials">
<xsl:param name="topicid" />
<xsl:message>TRY REQUEST: <xsl:value-of
select="$P1_CONTENT"/></xsl:message>
....
And I get this result in the terminal window
Info: Step 4 Create the nav.adoc and antora.yaml.
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
TRY REQUEST: no
Thoughts?
..dan