XSLT instructions inside Schematron are working fine, but are they supposed to at all?
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 65
- Joined: Fri Jan 18, 2008 5:54 pm
XSLT instructions inside Schematron are working fine, but are they supposed to at all?
Post by Ron Van den Branden »
Hi,
I am writing an ISO Schematron file for validating my XML files, and have encountered a nice feature, but am wondering about its status.
It seems that embedded XSLT instructions in a Schematron file are just processed. For example, following Schematron file contains a dummy rule that will always fire on the document element of an XML file and output the value of an XSLT variable, using several XSLT instructions (<xsl:for-each>, <xsl:call-template>, <xsl:function>, and <xsl:variable>):
If this file is stored as "schematron+xslt.sch" and used for validating any XML file:
...it all seems to work perfectly: the value of the XSLT variable $test is correctly retrieved.
So far, so good. Yet, I'm puzzled if this is a feature, or a bug, or an unintended side-effect, either of the specification, the implementation, or Oxygen. The Schematron specification only mentions following XSLT elements in Annex H: Query language binding for XSLT 2:
Best,
Ron
I am writing an ISO Schematron file for validating my XML files, and have encountered a nice feature, but am wondering about its status.
It seems that embedded XSLT instructions in a Schematron file are just processed. For example, following Schematron file contains a dummy rule that will always fire on the document element of an XML file and output the value of an XSLT variable, using several XSLT instructions (<xsl:for-each>, <xsl:call-template>, <xsl:function>, and <xsl:variable>):
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:local="local">
<!-- all XSLT -->
<xsl:variable name="test">test value</xsl:variable>
<xsl:template name="get.test">
<xsl:value-of select="local:get.test()"/>
</xsl:template>
<xsl:function name="local:get.test">
<xsl:value-of select="$test"/>
</xsl:function>
<!-- a dummy Schematron pattern that will always trigger for the document node, just to show how various XSLT instructions seem to be executed in Schematron without problem. -->
<sch:pattern>
<sch:rule context="/*">
<sch:report test="true() or false()">
This rule will always fire, demonstrating how XSLT instructions seem to be executed without problems in Schematron. For example, the named template "get.test" will execute the function "local:get.test()" which will retrieve the value of the variable $test, namely: '<xsl:for-each select="."><xsl:call-template name="get.test"/></xsl:for-each>'
</sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="schematron+xslt.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<test/>
So far, so good. Yet, I'm puzzled if this is a feature, or a bug, or an unintended side-effect, either of the specification, the implementation, or Oxygen. The Schematron specification only mentions following XSLT elements in Annex H: Query language binding for XSLT 2:
- <xsl:key>
- <xsl:function>
- <xsl:copy-of>
Best,
Ron
-
- Posts: 389
- Joined: Thu Jul 01, 2004 12:29 pm
Re: XSLT instructions inside Schematron are working fine, but are they supposed to at all?
Hello Ron,
The Schematron specification does not mention that you can use XSLT in Schematron. But Schematron was designed somehow to use XSLT.
The reference implementation uses XSLT: http://schematron.com/front-page/the-sc ... ementation
Therefore, the use of XSLT in Schematron is implementation specific. All the implementations that uses "skeleton", including the one from <oXygen/>, will support XSLT inside Schematron.
Best Regards,
Octavian
The Schematron specification does not mention that you can use XSLT in Schematron. But Schematron was designed somehow to use XSLT.
The reference implementation uses XSLT: http://schematron.com/front-page/the-sc ... ementation
Therefore, the use of XSLT in Schematron is implementation specific. All the implementations that uses "skeleton", including the one from <oXygen/>, will support XSLT inside Schematron.
Best Regards,
Octavian
Octavian Nadolu
<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)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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