Local variables/parameters in XSpec
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 10
- Joined: Fri May 22, 2020 6:44 pm
Local variables/parameters in XSpec
I'm trying to better understand local variables/parameters in XSpec.
My XSL adds '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.
If I use a global variable or parameter, the first scenario then passes, but of course the second fails.
I have seen local parameters and variables used with function and template calls, but not with context. Is it at all possible? I have multiple global parameters and variables and I would like to test the different combinations without requiring a separate test file for each.
My XSL adds '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.
Code: Select all
<!-- Fails -->
<x:scenario label="Bookmap 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="Bookmap Other output">
<x:context>
<bookmap/>
</x:context>
<x:expect label="No chunking">
<bookmap/>
</x:expect>
</x:scenario>
Code: Select all
<!-- Passes -->
<x:param name="output-format" select="'pdf'" as="xs:string"/>
<x:scenario label="Bookmap 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="Bookmap Other output">
<x:context>
<bookmap/>
</x:context>
<x:expect label="No chunking">
<bookmap/>
</x:expect>
</x:scenario>
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: Local variables/parameters in XSpec
Post by adrian_sorop »
Hi,
Unfortunately, this question is a bit outside of our scope. I think the xspec forum and xspec wiki are the right places to discuss this topic.
Meanwhile, here is the xspec wiki: https://github.com/xspec/xspec/wiki
You can find usefull resources there, like and many others, with proper examples.
Regards,
Adrian S.
Unfortunately, this question is a bit outside of our scope. I think the xspec forum and xspec wiki are the right places to discuss this topic.
Meanwhile, here is the xspec wiki: https://github.com/xspec/xspec/wiki
You can find usefull resources there, like and many others, with proper examples.
Regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service