How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Post by Martin Honnen »
oXygen 19 now supports Saxon 9.7 EE or PE to run XSLT 3.0 transformations, a new feature in XSLT 3.0 is the predefined template name xsl:initial-template for a named template e.g.
When you run Saxon from the command line the -it option suffices to select that template as the initially executed starting point of the transformation. How can I achieve that in oXygen 19 with Saxon 9.7 EE selected as the transformer? I can set the initial template in the options to that name but when I try to run the transformation I get the errors
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
expand-text="yes"
version="3.0">
<xsl:param name="seq" as="xs:string*" select="'c', 'a', 'b', 'z'"/>
<xsl:template name="xsl:initial-template">
This is a test {sort($seq)}
</xsl:template>
</xsl:stylesheet>
Code: Select all
System ID: C:\Users\User\Somepath\test2017040601.xsl
Scenario: test2017040601
XSL file: C:\Users\User\Somepath\test2017040601.xsl
Engine name: Saxon-EE 9.7.0.15
Severity: error
Description: The requested initial template xsl:initial-template does not exist
System ID: C:\Users\User\Somepath\test2017040601.xsl
Scenario: test2017040601
XSL file: C:\Users\User\Somepath\test2017040601.xsl
Engine name: Saxon-EE 9.7.0.15
Severity: fatal
Description: XTDE0040: The requested initial template xsl:initial-template does not exist
URL: http://www.w3.org/TR/xslt20/#err-XTDE0040
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Hello,
I'm afraid v19.0 does not yet support the default initial template that Saxon 9.7 supports.
The problem is Saxon 9.7 does not seem to work if you explicitly specify the default initial template name, which is mandatory in Oxygen. So it won't work with -it:"xsl:initial-template", it fails with "Template xsl:initial-template does not exist (or is not public)". This is why it doesn't work like that in Oxygen either.
I have logged an issue for this. We will notify this thread when it is implemented/supported.
Until then I propose using the following workaround:
- declare a template (e.g. main) that calls the default initial template:
- configure the initial template in the advanced options from Oxygen to that name ("main").
Outside of Oxygen you can simply rely on the "xsl:initial-template".
Regards,
Adrian
I'm afraid v19.0 does not yet support the default initial template that Saxon 9.7 supports.
The problem is Saxon 9.7 does not seem to work if you explicitly specify the default initial template name, which is mandatory in Oxygen. So it won't work with -it:"xsl:initial-template", it fails with "Template xsl:initial-template does not exist (or is not public)". This is why it doesn't work like that in Oxygen either.
I have logged an issue for this. We will notify this thread when it is implemented/supported.
Until then I propose using the following workaround:
- declare a template (e.g. main) that calls the default initial template:
Code: Select all
<xsl:template name="main">
<xsl:call-template name="xsl:initial-template"/>
</xsl:template>
Outside of Oxygen you can simply rely on the "xsl:initial-template".
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
Re: How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Post by Martin Honnen »
I managed to get it to work with oXygen by specifying the template name in the form instead of .
Code: Select all
{http://www.w3.org/1999/XSL/Transform}initial-template
Code: Select all
xsl:initial-template
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Hi,
Good find. I can confirm your workaround. I have tested and it works in both Oxygen 19.0 and Oxygen 18.x + Saxon-EE 9.7 External Add-on.
Regards,
Adrian
Good find. I can confirm your workaround. I have tested and it works in both Oxygen 19.0 and Oxygen 18.x + Saxon-EE 9.7 External Add-on.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
-
- Posts: 2
- Joined: Fri Jun 07, 2019 5:39 pm
Re: How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Post by geddie2001 »
Hi,
I have this in my stylesheet:
However, I'm getting the following error:
I am using Saxon-PE 9.6.0.7
I have this in my stylesheet:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
exclude-result-prefixes="xs math"
version="3.0">
<xsl:template name="main">
<xsl:call-template name="{http://www.w3.org/1999/XSL/Transform}initial-template"/>
</xsl:template>
</xsl:stylesheet>
Code: Select all
XTSE0020: Both the prefix {{http} and the local part {//www.w3.org/1999/XSL/Transfor...} are invalid
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
Re: How to use a template named xsl:initial-template with XSLT 3.0 and oXygen 19
Post by Martin Honnen »
The thread so far was about using the oXygen GUI to use a transformation scenario and run Saxon with XSLT 3 without a primary source but to start with that particular named template the XSLT 3.0 spec defines.
It is not clear how your post relates to that as you have presented XSLT code using
which doesn't make any sense as your stylesheet does contain any such template you want to call.
Furthermore the first Saxon release to implement the final XSLT 3 standard is Saxon 9.8.
I can't tell whether 9.6 supports enhanced QNames in the name attribute of call-template but the syntax for that in code would be (https://www.w3.org/TR/xpath-30/#prod-xp ... lifiedName)
And of course using
would do as well, as long as 9.6 supports that XSLT 3 feature.
It is not clear how your post relates to that as you have presented XSLT code using
Code: Select all
<xsl:call-template name="{http://www.w3.org/1999/XSL/Transform}initial-template"/>
Furthermore the first Saxon release to implement the final XSLT 3 standard is Saxon 9.8.
I can't tell whether 9.6 supports enhanced QNames in the name attribute of call-template but the syntax for that in code would be (https://www.w3.org/TR/xpath-30/#prod-xp ... lifiedName)
Code: Select all
<xsl:call-template name="Q{http://www.w3.org/1999/XSL/Transform}initial-template"/>
Code: Select all
<xsl:call-template name="xsl:initial-template"/>
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