I'm hoping someone can point me to how to accomplish this task.
I wish to set a PI in an x:context and use it to determine whether an assert is true. Currently I get an error regarding the context item of the axis for the PI.
I am using oXygen 24.0 and the built in Saxon EE 9.9.1.7.
Thank you.
Error: The context item for axis step root/descendant::processing-instruction(UseDebugMode) is absent
The xspec:<x:description
schematron="xspec-PI-test.sch"
xmlns:x="
http://www.jenitennison.com/xslt/xspec">
<x:scenario
label="In a document">
<x:scenario
label="when the foo element">
<x:scenario
label="is present and debug mode is true">
<x:context>
<?useDebugMode test="true"?>
<root>
<foo />
</root>
</x:context>
<x:expect-not-assert
id="foo-element-exists"
label="that is correct" />
</x:scenario>
<x:scenario
label="is absent and debug mode is true">
<x:context>
<?useDebugMode test="true"?>
<root/>
</x:context>
<x:expect-assert
id="foo-element-exists"
label="that is incorrect" />
</x:scenario>
</x:scenario>
</x:scenario>
</x:description>
The Schematron:<sch:schema
xmlns:sch="
http://purl.oclc.org/dsdl/schematron">
<sch:let
name="use-debug-mode"
value="substring-before(substring-after(//processing-instruction('UseDebugMode'), 'test="'), '"')" />
<sch:pattern id="root">
<sch:rule
context="root">
<sch:assert
diagnostics="foo-element-exists-diagnostic"
id="foo-element-exists"
role="fatal"
test="$use-debug-mode='true'">The foo element child of root exists.</sch:assert>
</sch:rule>
</sch:pattern>
<sch:diagnostics>
<sch:diagnostic
id="foo-element-exists-diagnostic">A foo element child of root does not exist.</sch:diagnostic>
</sch:diagnostics>
</sch:schema>
Notice: The information contained in this message or any attached document is confidential and intended only for individuals to whom it is addressed. If you got this message in error, please inform me immediately using one of the methods above. In some cases, I may ask you to return the documents at my expense. In general, please simply destroy the information at once. Any unauthorized use, distribution, or copying of this information is prohibited.