I'm trying to better understand local variables/parameters in XSpec.
My XSL adds the attribute 'chunk="to-content"' to a bookmap element if the global parameter 'output-format' has value "pdf".
I thought the below would pass testing for both scenarios, by having the output-format parameter inside the first context element, but the first scenario fails. It also fails if I use a variable inside the scenario.
<!-- Fails -->
<x:scenario label="PDF output">
<x:context>
<x:param name="output-format" select="'pdf'" as="xs:string"/>
<bookmap/>
</x:context>
<x:expect label="Chunk to-content">
<bookmap chunk="to-content"/>
</x:expect>
</x:scenario>
<!-- Passes -->
<x:scenario label="Other output">
<x:context>
<bookmap/>
</x:context>
<x:expect label="No chunking">
<bookmap/>
</x:expect>
</x:scenario>
If I use a global variable or parameter, then the first scenario passes, but of course the second fails.
<x:param name="output-format" select="'pdf'" as="xs:string"/>
<!-- Passes -->
<x:scenario label="PDF output">
<x:context>
<bookmap/>
</x:context>
<x:expect label="Chunk to-content">
<bookmap chunk="to-content"/>
</x:expect>
</x:scenario>
<!-- Fails -->
<x:scenario label="Other output">
<x:context>
<bookmap/>
</x:context>
<x:expect label="No chunking">
<bookmap/>
</x:expect>
</x:scenario>
I have multiple global parameters and variables and I would like to test the different combinations without requiring a separate test file for each. Is this possible?