Passing value from ask editor variable to stylesheet

Here should go questions about transforming XML with XSLT and FOP.
Garrett_3
Posts: 9
Joined: Fri Feb 12, 2021 8:46 pm

Passing value from ask editor variable to stylesheet

Post by Garrett_3 »

Is it possible to pass a value from a question asked during the start of a transformation scenario to a stylesheet for use in an if statement?
Garrett
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: Passing value from ask editor variable to stylesheet

Post by tavy »

Hello,

You can create a transformation scenario and define in the scenario a parameter. For example you can define a parameter with the name "askParam" and the value '${ask('Specify the value', String, 'val')}', and then use the parameter in the stylesheet.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  version="2.0">
    <xsl:param name="askParam"/>
    <xsl:template match="/">
        <xsl:value-of select="$askParam"/>
    </xsl:template>
</xsl:stylesheet>
Find more about editor variable in our user manual: https://www.oxygenxml.com/doc/versions/ ... ables.html

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply