Schematron QuickFix

Octavian Nadolu
Octavian NadoluSoftware Architect at Syncro Soft (oXygen XML Editor)
Schematron QuickFix
Nico Kutscherauer
contact@schematron-quickfix.com
@nkutsche
Octavian Nadolu
octavian_nadolu@oxygenxml.com
@OctavianNadolu
Schematron QuickFixSchematron QuickFix
Error Fixes
● Fixing errors has always been a challenge
● Solutions offered by IDEs
Schematron QuickFixSchematron QuickFix
Fix Proposals
● Using fix proposals to solve errors:
– Better understanding of the problem
– Fewer (no) mistakes
– Saves time (money)
Schematron QuickFixSchematron QuickFix
XML Validation Errors
● From the user's perspective the validation error
is composed by three things
LocationLocation
How toHow to
fix it ?fix it ?
MessageMessage
Schematron QuickFixSchematron QuickFix
Fixing XML Validation Errors
● Predefined Errors - defined in the validation
engine
– Fixes generated from the validation engine
– Fixes based on the message (error code) and location
● Custom Errors - defined by the user
– Difficult to generate fixes based on message and location
– A language to create fixes is more appropriate
How toHow to
fix it ?fix it ?
Schematron QuickFixSchematron QuickFix
Schematron Fix Proposals
● User-defined fixes for Schematron errors
● Schematron QuickFix (SQF) language
– Extends the Schematron language
– SQF initiated by Nico Kutscherauer
www.schematron-quickfix.com
github.com/schematron-quickfix/sqf
Schematron QuickFixSchematron QuickFix
Schematron Quick Fixes Spec
www.w3.org/community/quickfix
schematron-quickfix.github.io/sqf
Schematron QuickFixSchematron QuickFix
SQF Extension of the Schematron
● Associated with assert and report elements
● Added as Schematron annotations
<rule context="html">
<report test="//comment()" sqf:fix="removeComments">
Comments are not allowed in document.</report>
<sqf:fix id="removeComments" role="delete">
<sqf:description>
<sqf:title>Remove all comments</sqf:title>
<sqf:p>Remove all comment nodes from the current document</sqf:p>
</sqf:description>
<sqf:delete match="//comment()"/>
</sqf:fix>
</rule>
Schematron QuickFixSchematron QuickFix
Schematron QuickFix (SQF)
<sqf:fix id="resolveBold">
<sqf:description>
<sqf:title>Change the bold element into text</sqf:title>
<sqf:p>Removes the bold (b) markup and keeps the text content.</sqf:p>
</sqf:description>
<sqf:replace match="b" select="text()"/>
</sqf:fix>
Operation
ID
Description
Title
Schematron QuickFixSchematron QuickFix
SQF Benefits
● Create custom quick fixes for errors
Schematron QuickFixSchematron QuickFix
SQF Benefits
● Create custom quick fixes for errors
● Use the power of Schematron and XSLT
Schematron QuickFixSchematron QuickFix
SQF Benefits
● Create custom quick fixes for errors
● Use the power of Schematron and XSLT
● Create refactoring actions using SQF
Schematron QuickFixSchematron QuickFix
SQF Benefits
● Create custom quick fixes for errors
● Use the power of Schematron and XSLT
● Create refactoring actions using SQF
● Fix problems in external documents
Schematron QuickFixSchematron QuickFix
SQF Benefits
● Create custom quick fixes for errors
● Use the power of Schematron and XSLT
● Create refactoring actions using SQF
● Fix problems in external documents
● Fixes for any XML documents
Schematron QuickFixSchematron QuickFix
Language Overview
● Small language
● Keep it easy, but extensible
● No knowledge of XSLT is needed for simple cases
● Integration of well-known standards for more
complex things
Schematron QuickFixSchematron QuickFix
Language Overview
● Small language
● Keep it easy, but extensible
● No knowledge of XSLT is needed for simple cases
● Integration of well-known standards for more
complex things
● Own Namespace with prefix sqf:
http://www.schematron-quickfix.com/validator/process
Schematron QuickFixSchematron QuickFix
Language Structure
● Reference / structure
● User interface
● Activity Elements (operations)
Schematron QuickFixSchematron QuickFix
Language Structure
● Reference / structure
● User interface
● Activity Elements (operations)
● Generic features
Schematron QuickFixSchematron QuickFix
Learning By Examples
● Five examples are shown
● All to find on
https://github.com/octavianN/SQFPresentation/tree/master/Samples
● Additional Examples
http://www.schematron-quickfix.com/examples.html
● Tutorial
http://www.schematron-quickfix.com/quickFix/guide.html
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
1. Simple Replace
● Replace or unwrap a node
<sch:rule context="b">
<sch:report test="ancestor::b"
sqf:fix="italic unwrap">
Bold in bold is not allowed.</sch:report>
<sqf:fix id="italic">
<sqf:description>
<sqf:title>Change it to italic.</sqf:title>
</sqf:description>
<sqf:replace match="." node-type="element" target="i" select="node()"/>
</sqf:fix>
<sqf:fix id="unwrap">
<sqf:description>
<sqf:title>Unwrap <sch:name/> element</sqf:title>
</sqf:description>
<sqf:replace select="node()"/>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
2. User Entries
● User Entry – parameter of the QuickFix
<sch:rule context="title">
<sch:assert test="normalize-space(.) != '' " sqf:fix="title"
>A title shouldn't be empty.</sch:assert>
<sqf:fix id="title">
<sqf:description>
<sqf:title>Set a title</sqf:title>
<sqf:p>This QuickFix will set a title by using a User Entry.</sqf:p>
</sqf:description>
<sqf:user-entry name="title" type="xs:string">
<sqf:description>
<sqf:title>Please enter the new title.</sqf:title>
</sqf:description>
</sqf:user-entry>
<sqf:replace target="{name()}" node-type="element"
select="$title" />
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
2. User Entries
● User Entry – parameter of the QuickFix
<sch:rule context="title">
<sch:assert test="normalize-space(.) != '' " sqf:fix="title"
>A title shouldn't be empty.</sch:assert>
<sqf:fix id="title">
<sqf:description>
<sqf:title>Set a title</sqf:title>
<sqf:p>This QuickFix will set a title by using a User Entry.</sqf:p>
</sqf:description>
<sqf:user-entry name="title" type="xs:string">
<sqf:description>
<sqf:title>Please enter the new title.</sqf:title>
</sqf:description>
</sqf:user-entry>
<sqf:replace target="{name()}" node-type="element"
select="$title" />
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
3. QuickFix Conditions
● Conditions – provide a QuickFix only if it makes
sense
<sch:rule context="head/title">
<sch:assert test="string-length(normalize-space(.)) le 20 "
sqf:fix="title">
A title shouldn't have more than 20 characters.</sch:assert>
<sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]">
<sqf:description>
<sqf:title>
Set the title to "<sch:value-of select="//h1[1]"/>".
</sqf:title>
</sqf:description>
<sqf:replace target="title" node-type="element">
<sch:value-of select="//h1[1]"/>
</sqf:replace>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
3. QuickFix Conditions
● Conditions – provide a QuickFix only if it makes
sense
<sch:rule context="head/title">
<sch:assert test="string-length(normalize-space(.)) le 20 "
sqf:fix="title">
A title shouldn't have more than 20 characters.</sch:assert>
<sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]">
<sqf:description>
<sqf:title>
Set the title to "<sch:value-of select="//h1[1]"/>".
</sqf:title>
</sqf:description>
<sqf:replace target="title" node-type="element">
<sch:value-of select="//h1[1]"/>
</sqf:replace>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
3. QuickFix Conditions
● Conditions – provide a QuickFix only if it makes
sense
<sch:rule context="head/title">
<sch:assert test="string-length(normalize-space(.)) le 20 "
sqf:fix="title">
A title shouldn't have more than 20 characters.</sch:assert>
<sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]">
<sqf:description>
<sqf:title>
Set the title to "<sch:value-of select="//h1[1]"/>".
</sqf:title>
</sqf:description>
<sqf:replace target="title" node-type="element">
<sch:value-of select="//h1[1]"/>
</sqf:replace>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
4. Dynamic QuickFixes
● Dynamic QuickFixes – in the future
<sch:rule context="head/title">
<sch:assert test="string-length(normalize-space(.)) le 20 "
sqf:fix="title">
A title shouldn't have more than 20 characters.</sch:assert>
<sqf:fix id="title" use-for-each="//h1[string-length(.) le 20]">
<sqf:description>
<sqf:title>
Set the title to "<sch:value-of select="$sqf:current"/>".
</sqf:title>
</sqf:description>
<sqf:replace target="title" node-type="element">
<sch:value-of select="$sqf:current"/>
</sqf:replace>
</sqf:fix>
</sch:rule>
Schematron QuickFixSchematron QuickFix
5. Call QuickFixes
<sqf:fix id="title">
<sqf:call-fix ref="createElementRowAsFirstChild">
<sqf:with-param name="match" select="."/>
<sqf:with-param name="el" select=" 'col' "/>
<sqf:with-param name="count" select="count(max(.//tr/count(td|th)))"/>
</sqf:call-fix>
</sqf:fix>
<sqf:fix id="createElementRowAsFirstChild">
<sqf:param name="match" type="node()*"/>
<sqf:param name="el" type="xs:QName"/>
<sqf:param name="count" type="xs:integer"/>
<sqf:description>
<sqf:title>Create a row of <sch:value-of select="$count"/>
<sch:name path="$el"/> elements as a first child of the
<sch:name path="$match"/> element(s).</sqf:title>
</sqf:description>
<sqf:add match="$match" position="first-child">
<xsl:for-each select="1 to $count">
<xsl:element name="{$el}"/>
</xsl:for-each>
</sqf:add>
</sqf:fix>
Schematron QuickFixSchematron QuickFix
Call QuickFixes
● In the first draft:
● Just a prototype
● Not really functional
● Improvements of the second draft:
● Multiple sqf:call-fix in one sqf:fix
● Use the description of the called fix
→ Open discussion
Schematron QuickFixSchematron QuickFix
Review
● Structure / Reference
● sqf:fix, @id, @use-when, @sqf:fix, sqf:group, sqf:fixes
● Description
● sqf:description, sqf:title, sqf:p
● Activity
● sqf:delete, sqf:replace, sqf:add, sqf:keep, sqf:stringReplace
● Generic
● sqf:call-fix, sqf:with-param, sqf:param, sqf:user-entry,
@use-for-each
→ Only 15 Elements (XSLT 2: 49, Schematron: 21)
Schematron QuickFixSchematron QuickFix
SQF Implementations
● <oXygen/> XML Editor validation engine
http://www.oxygenxml.com
● Escali Schematron engine
http://schematron-quickfix.com/escali_xsm.html
– Escali Schematron command line tool
– Oxygen plugin for invoking Escali Schematron
Schematron QuickFixSchematron QuickFix
Projects using SQF
● Thieme - publishing company uses a custom
framework to create and edit XML documents
● parsX - a product developed by pagina GmbH
used to facilitate EPUB production
● ART-DECOR - an open source tool suite that
supports SDOs active in the healthcare industry
Sample SQF embedded in XSD
● ATX custom framework – used by a major
automotive producer
Schematron QuickFixSchematron QuickFix
Projects using SQF
● Dynamic Information Model (DIM) - an
implementation of an intelligent style guide
● Schematron for TEI - collection of Schematron
and SQF resources for TEI
● <oXygen/> DITA framework - built-in framework
in <oXygen/> XML Editor for DITA documents
● <oXygen/> XML userguide - the public version of
the <oXygen/> User Manual
Schematron QuickFixSchematron QuickFix
Conclusions and Future Plans
● SQF is a simple and useful language
● Helps users to solve the problems in less time
and with fewer (no) errors
● Update the SQF specification
● Publish the second draft of the Schematron
QuickFix specification
Schematron QuickFixSchematron QuickFix
Thank you!
Questions?
contact@schematron-quickfix.com
@nkutsche
octavian_nadolu@oxygenxml.com
@OctavianNadolu
1 of 40

Recommended

Schematron QuickFix on XMLPrague by
Schematron QuickFix on XMLPragueSchematron QuickFix on XMLPrague
Schematron QuickFix on XMLPragueNico Kutscherauer
1.4K views7 slides
Schematron & SQF In oXygen by
Schematron & SQF In oXygenSchematron & SQF In oXygen
Schematron & SQF In oXygenOctavian Nadolu
375 views12 slides
XML Quick Fixes by
XML Quick FixesXML Quick Fixes
XML Quick FixesOctavian Nadolu
665 views20 slides
Java concurrency by
Java concurrencyJava concurrency
Java concurrencySrinivasan Raghvan
561 views20 slides
Performance Test Automation With Gatling by
Performance Test Automation  With GatlingPerformance Test Automation  With Gatling
Performance Test Automation With GatlingKnoldus Inc.
1.8K views27 slides
Service stack linkedin by
Service stack linkedinService stack linkedin
Service stack linkedinRaju Golla
825 views21 slides

More Related Content

What's hot

JChem Microservices by
JChem MicroservicesJChem Microservices
JChem MicroservicesChemAxon
206 views21 slides
Sql plsql online training by
Sql plsql online trainingSql plsql online training
Sql plsql online trainingenrollmy training
288 views10 slides
Gatling overview by
Gatling overviewGatling overview
Gatling overviewViral Jain
1.2K views14 slides
Module Owb External Execution by
Module Owb External ExecutionModule Owb External Execution
Module Owb External ExecutionNicholas Goodman
455 views8 slides
Gatling Performance Workshop by
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance WorkshopSai Krishna
530 views20 slides
Performant Django - Ara Anjargolian by
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara AnjargolianHakka Labs
3.4K views22 slides

Similar to Schematron QuickFix

XML Quick Fixes by
XML Quick FixesXML Quick Fixes
XML Quick FixesOctavian Nadolu
572 views40 slides
Schematron 2016 and SQF Update by
Schematron 2016 and SQF Update Schematron 2016 and SQF Update
Schematron 2016 and SQF Update Octavian Nadolu
478 views19 slides
The Power Of Schematron Quick Fixes - XML Prague 2019 by
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019Octavian Nadolu
350 views32 slides
Struts2-Spring=Hibernate by
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=HibernateJay Shah
784 views53 slides
Varnish - PLNOG 4 by
Varnish - PLNOG 4Varnish - PLNOG 4
Varnish - PLNOG 4Leszek Urbanski
3.6K views82 slides
Enforcing Business Rules - Automatic Fixes by
Enforcing Business Rules - Automatic FixesEnforcing Business Rules - Automatic Fixes
Enforcing Business Rules - Automatic FixesOctavian Nadolu
393 views40 slides

Similar to Schematron QuickFix(20)

Schematron 2016 and SQF Update by Octavian Nadolu
Schematron 2016 and SQF Update Schematron 2016 and SQF Update
Schematron 2016 and SQF Update
Octavian Nadolu478 views
The Power Of Schematron Quick Fixes - XML Prague 2019 by Octavian Nadolu
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019
Octavian Nadolu350 views
Struts2-Spring=Hibernate by Jay Shah
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
Jay Shah784 views
Enforcing Business Rules - Automatic Fixes by Octavian Nadolu
Enforcing Business Rules - Automatic FixesEnforcing Business Rules - Automatic Fixes
Enforcing Business Rules - Automatic Fixes
Octavian Nadolu393 views
Strut2-Spring-Hibernate by Jay Shah
Strut2-Spring-HibernateStrut2-Spring-Hibernate
Strut2-Spring-Hibernate
Jay Shah331 views
Jboss World 2011 Infinispan by cbo_
Jboss World 2011 InfinispanJboss World 2011 Infinispan
Jboss World 2011 Infinispan
cbo_1.6K views
Tech talk specflow_bddx_hassa_nagy by Skills Matter
Tech talk specflow_bddx_hassa_nagyTech talk specflow_bddx_hassa_nagy
Tech talk specflow_bddx_hassa_nagy
Skills Matter858 views
Tuning and development with SIP Servlets on Mobicents by Jean Deruelle
Tuning and development with SIP Servlets on MobicentsTuning and development with SIP Servlets on Mobicents
Tuning and development with SIP Servlets on Mobicents
Jean Deruelle4.7K views
Windows Server AppFabric Caching - What it is & when you should use it? by Robert MacLean
Windows Server AppFabric Caching - What it is & when you should use it?Windows Server AppFabric Caching - What it is & when you should use it?
Windows Server AppFabric Caching - What it is & when you should use it?
Robert MacLean2.6K views
Angular 2 for Java Developers by Yakov Fain
Angular 2 for Java DevelopersAngular 2 for Java Developers
Angular 2 for Java Developers
Yakov Fain25.9K views
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR" by Fwdays
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Fwdays206 views
REACT.JS : Rethinking UI Development Using JavaScript by Deepu S Nath
REACT.JS : Rethinking UI Development Using JavaScriptREACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScript
Deepu S Nath919 views
Make your gui shine with ajax solr by lucenerevolution
Make your gui shine with ajax solrMake your gui shine with ajax solr
Make your gui shine with ajax solr
lucenerevolution11.5K views
Complex Made Simple: Sleep Better with TorqueBox by bobmcwhirter
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
bobmcwhirter1.7K views
Angular 2 at solutions.hamburg by Baqend
Angular 2 at solutions.hamburgAngular 2 at solutions.hamburg
Angular 2 at solutions.hamburg
Baqend28 views
Fast federated SQL with Apache Calcite by Chris Baynes
Fast federated SQL with Apache CalciteFast federated SQL with Apache Calcite
Fast federated SQL with Apache Calcite
Chris Baynes1.4K views
SamzaSQL QCon'16 presentation by Yi Pan
SamzaSQL QCon'16 presentationSamzaSQL QCon'16 presentation
SamzaSQL QCon'16 presentation
Yi Pan1.9K views

More from Octavian Nadolu

Oxygen JSON Editor by
Oxygen JSON EditorOxygen JSON Editor
Oxygen JSON EditorOctavian Nadolu
25 views41 slides
Leveraging the Power of AI and Schematron for Content Verification and Correc... by
Leveraging the Power of AI and Schematron for Content Verification and Correc...Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...Octavian Nadolu
19 views51 slides
JSON, JSON Schema, and OpenAPI by
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIOctavian Nadolu
137 views33 slides
Create an Design JSON Schema by
Create an Design JSON SchemaCreate an Design JSON Schema
Create an Design JSON SchemaOctavian Nadolu
57 views36 slides
Compare And Merge Scripts by
Compare And Merge ScriptsCompare And Merge Scripts
Compare And Merge ScriptsOctavian Nadolu
52 views40 slides
JSON Schema Design by
JSON Schema DesignJSON Schema Design
JSON Schema DesignOctavian Nadolu
163 views31 slides

More from Octavian Nadolu(20)

Leveraging the Power of AI and Schematron for Content Verification and Correc... by Octavian Nadolu
Leveraging the Power of AI and Schematron for Content Verification and Correc...Leveraging the Power of AI and Schematron for Content Verification and Correc...
Leveraging the Power of AI and Schematron for Content Verification and Correc...
Octavian Nadolu19 views
Schematron For Non-XML Languages by Octavian Nadolu
Schematron For Non-XML LanguagesSchematron For Non-XML Languages
Schematron For Non-XML Languages
Octavian Nadolu363 views
Documentation Quality Assurance with ISO Schematron by Octavian Nadolu
Documentation Quality Assurance with ISO SchematronDocumentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO Schematron
Octavian Nadolu146 views
JSON Edit, Validate, Query, Transform, and Convert by Octavian Nadolu
JSON Edit, Validate, Query, Transform, and ConvertJSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and Convert
Octavian Nadolu418 views
Collaboration Tools to Help Improve Documentation Process by Octavian Nadolu
Collaboration Tools to Help Improve Documentation ProcessCollaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation Process
Octavian Nadolu175 views
Exploring the new features in Oxygen XML Editor 20 - Development by Octavian Nadolu
Exploring the new features in Oxygen XML Editor 20 - DevelopmentExploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - Development
Octavian Nadolu621 views
Comparing and Merging XML Documents in Visual Mode by Octavian Nadolu
Comparing and Merging XML Documents in Visual ModeComparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual Mode
Octavian Nadolu349 views
XSLT 3.0 Improvements - XML Prague 2018 by Octavian Nadolu
XSLT 3.0 Improvements - XML Prague 2018XSLT 3.0 Improvements - XML Prague 2018
XSLT 3.0 Improvements - XML Prague 2018
Octavian Nadolu866 views
Enforcing Style Guide Rules for Technical Documents by Octavian Nadolu
Enforcing Style Guide Rules for Technical DocumentsEnforcing Style Guide Rules for Technical Documents
Enforcing Style Guide Rules for Technical Documents
Octavian Nadolu594 views
Schematron business rules checks and corrections - updates by Octavian Nadolu
Schematron business rules checks and corrections - updatesSchematron business rules checks and corrections - updates
Schematron business rules checks and corrections - updates
Octavian Nadolu175 views

Recently uploaded

OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllister by
OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllisterOSMC 2023 | Know your data: The stats behind your alerts by Dave McAllister
OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllisterNETWAYS
10 views38 slides
Thanks Giving Encouragement Wednesday.pptx by
Thanks Giving Encouragement Wednesday.pptxThanks Giving Encouragement Wednesday.pptx
Thanks Giving Encouragement Wednesday.pptxFamilyWorshipCenterD
10 views13 slides
CitSciOz MOUA Inspiring Change Through Art by
CitSciOz MOUA Inspiring Change Through ArtCitSciOz MOUA Inspiring Change Through Art
CitSciOz MOUA Inspiring Change Through ArtChristian Bartens
43 views16 slides
231121 SP slides - PAS workshop November 2023.pdf by
231121 SP slides - PAS workshop November 2023.pdf231121 SP slides - PAS workshop November 2023.pdf
231121 SP slides - PAS workshop November 2023.pdfPAS_Team
150 views15 slides
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru... by
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...NETWAYS
7 views20 slides
HITCON CISO Summit 2023 - Closing by
HITCON CISO Summit 2023 - ClosingHITCON CISO Summit 2023 - Closing
HITCON CISO Summit 2023 - ClosingHacks in Taiwan (HITCON)
178 views33 slides

Recently uploaded(20)

OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllister by NETWAYS
OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllisterOSMC 2023 | Know your data: The stats behind your alerts by Dave McAllister
OSMC 2023 | Know your data: The stats behind your alerts by Dave McAllister
NETWAYS10 views
231121 SP slides - PAS workshop November 2023.pdf by PAS_Team
231121 SP slides - PAS workshop November 2023.pdf231121 SP slides - PAS workshop November 2023.pdf
231121 SP slides - PAS workshop November 2023.pdf
PAS_Team150 views
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru... by NETWAYS
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...
OSMC 2023 | IGNITE: Metrics, Margins, Mutiny – How to make your SREs (not) ru...
NETWAYS7 views
BLogSite (Web Programming) (1).pdf by Fiverr
BLogSite (Web Programming) (1).pdfBLogSite (Web Programming) (1).pdf
BLogSite (Web Programming) (1).pdf
Fiverr11 views
Christan van Dorst - Hyteps by Dutch Power
Christan van Dorst - HytepsChristan van Dorst - Hyteps
Christan van Dorst - Hyteps
Dutch Power65 views
Helko van den Brom - VSL by Dutch Power
Helko van den Brom - VSLHelko van den Brom - VSL
Helko van den Brom - VSL
Dutch Power63 views
Post-event report intro session-1.docx by RohitRathi59
Post-event report intro session-1.docxPost-event report intro session-1.docx
Post-event report intro session-1.docx
RohitRathi5912 views
Roozbeh Torkzadeh - TU Eindhoven by Dutch Power
Roozbeh Torkzadeh - TU EindhovenRoozbeh Torkzadeh - TU Eindhoven
Roozbeh Torkzadeh - TU Eindhoven
Dutch Power62 views
OSMC 2023 | IGNITE: Serving Server-Side WASM with Web Awareness with NGINX Un... by NETWAYS
OSMC 2023 | IGNITE: Serving Server-Side WASM with Web Awareness with NGINX Un...OSMC 2023 | IGNITE: Serving Server-Side WASM with Web Awareness with NGINX Un...
OSMC 2023 | IGNITE: Serving Server-Side WASM with Web Awareness with NGINX Un...
NETWAYS11 views
OSMC 2023 | Icinga for Windows – Age of PowerShell by Christian Stein by NETWAYS
OSMC 2023 | Icinga for Windows – Age of PowerShell by Christian SteinOSMC 2023 | Icinga for Windows – Age of PowerShell by Christian Stein
OSMC 2023 | Icinga for Windows – Age of PowerShell by Christian Stein
NETWAYS8 views
Speaking with confidence-converted.pdf by Abdul salam
Speaking with confidence-converted.pdfSpeaking with confidence-converted.pdf
Speaking with confidence-converted.pdf
Abdul salam 16 views

Schematron QuickFix

  • 2. Schematron QuickFixSchematron QuickFix Error Fixes ● Fixing errors has always been a challenge ● Solutions offered by IDEs
  • 3. Schematron QuickFixSchematron QuickFix Fix Proposals ● Using fix proposals to solve errors: – Better understanding of the problem – Fewer (no) mistakes – Saves time (money)
  • 4. Schematron QuickFixSchematron QuickFix XML Validation Errors ● From the user's perspective the validation error is composed by three things LocationLocation How toHow to fix it ?fix it ? MessageMessage
  • 5. Schematron QuickFixSchematron QuickFix Fixing XML Validation Errors ● Predefined Errors - defined in the validation engine – Fixes generated from the validation engine – Fixes based on the message (error code) and location ● Custom Errors - defined by the user – Difficult to generate fixes based on message and location – A language to create fixes is more appropriate How toHow to fix it ?fix it ?
  • 6. Schematron QuickFixSchematron QuickFix Schematron Fix Proposals ● User-defined fixes for Schematron errors ● Schematron QuickFix (SQF) language – Extends the Schematron language – SQF initiated by Nico Kutscherauer www.schematron-quickfix.com github.com/schematron-quickfix/sqf
  • 7. Schematron QuickFixSchematron QuickFix Schematron Quick Fixes Spec www.w3.org/community/quickfix schematron-quickfix.github.io/sqf
  • 8. Schematron QuickFixSchematron QuickFix SQF Extension of the Schematron ● Associated with assert and report elements ● Added as Schematron annotations <rule context="html"> <report test="//comment()" sqf:fix="removeComments"> Comments are not allowed in document.</report> <sqf:fix id="removeComments" role="delete"> <sqf:description> <sqf:title>Remove all comments</sqf:title> <sqf:p>Remove all comment nodes from the current document</sqf:p> </sqf:description> <sqf:delete match="//comment()"/> </sqf:fix> </rule>
  • 9. Schematron QuickFixSchematron QuickFix Schematron QuickFix (SQF) <sqf:fix id="resolveBold"> <sqf:description> <sqf:title>Change the bold element into text</sqf:title> <sqf:p>Removes the bold (b) markup and keeps the text content.</sqf:p> </sqf:description> <sqf:replace match="b" select="text()"/> </sqf:fix> Operation ID Description Title
  • 10. Schematron QuickFixSchematron QuickFix SQF Benefits ● Create custom quick fixes for errors
  • 11. Schematron QuickFixSchematron QuickFix SQF Benefits ● Create custom quick fixes for errors ● Use the power of Schematron and XSLT
  • 12. Schematron QuickFixSchematron QuickFix SQF Benefits ● Create custom quick fixes for errors ● Use the power of Schematron and XSLT ● Create refactoring actions using SQF
  • 13. Schematron QuickFixSchematron QuickFix SQF Benefits ● Create custom quick fixes for errors ● Use the power of Schematron and XSLT ● Create refactoring actions using SQF ● Fix problems in external documents
  • 14. Schematron QuickFixSchematron QuickFix SQF Benefits ● Create custom quick fixes for errors ● Use the power of Schematron and XSLT ● Create refactoring actions using SQF ● Fix problems in external documents ● Fixes for any XML documents
  • 15. Schematron QuickFixSchematron QuickFix Language Overview ● Small language ● Keep it easy, but extensible ● No knowledge of XSLT is needed for simple cases ● Integration of well-known standards for more complex things
  • 16. Schematron QuickFixSchematron QuickFix Language Overview ● Small language ● Keep it easy, but extensible ● No knowledge of XSLT is needed for simple cases ● Integration of well-known standards for more complex things ● Own Namespace with prefix sqf: http://www.schematron-quickfix.com/validator/process
  • 17. Schematron QuickFixSchematron QuickFix Language Structure ● Reference / structure ● User interface ● Activity Elements (operations)
  • 18. Schematron QuickFixSchematron QuickFix Language Structure ● Reference / structure ● User interface ● Activity Elements (operations) ● Generic features
  • 19. Schematron QuickFixSchematron QuickFix Learning By Examples ● Five examples are shown ● All to find on https://github.com/octavianN/SQFPresentation/tree/master/Samples ● Additional Examples http://www.schematron-quickfix.com/examples.html ● Tutorial http://www.schematron-quickfix.com/quickFix/guide.html
  • 20. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 21. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 22. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 23. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 24. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 25. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 26. Schematron QuickFixSchematron QuickFix 1. Simple Replace ● Replace or unwrap a node <sch:rule context="b"> <sch:report test="ancestor::b" sqf:fix="italic unwrap"> Bold in bold is not allowed.</sch:report> <sqf:fix id="italic"> <sqf:description> <sqf:title>Change it to italic.</sqf:title> </sqf:description> <sqf:replace match="." node-type="element" target="i" select="node()"/> </sqf:fix> <sqf:fix id="unwrap"> <sqf:description> <sqf:title>Unwrap <sch:name/> element</sqf:title> </sqf:description> <sqf:replace select="node()"/> </sqf:fix> </sch:rule>
  • 27. Schematron QuickFixSchematron QuickFix 2. User Entries ● User Entry – parameter of the QuickFix <sch:rule context="title"> <sch:assert test="normalize-space(.) != '' " sqf:fix="title" >A title shouldn't be empty.</sch:assert> <sqf:fix id="title"> <sqf:description> <sqf:title>Set a title</sqf:title> <sqf:p>This QuickFix will set a title by using a User Entry.</sqf:p> </sqf:description> <sqf:user-entry name="title" type="xs:string"> <sqf:description> <sqf:title>Please enter the new title.</sqf:title> </sqf:description> </sqf:user-entry> <sqf:replace target="{name()}" node-type="element" select="$title" /> </sqf:fix> </sch:rule>
  • 28. Schematron QuickFixSchematron QuickFix 2. User Entries ● User Entry – parameter of the QuickFix <sch:rule context="title"> <sch:assert test="normalize-space(.) != '' " sqf:fix="title" >A title shouldn't be empty.</sch:assert> <sqf:fix id="title"> <sqf:description> <sqf:title>Set a title</sqf:title> <sqf:p>This QuickFix will set a title by using a User Entry.</sqf:p> </sqf:description> <sqf:user-entry name="title" type="xs:string"> <sqf:description> <sqf:title>Please enter the new title.</sqf:title> </sqf:description> </sqf:user-entry> <sqf:replace target="{name()}" node-type="element" select="$title" /> </sqf:fix> </sch:rule>
  • 29. Schematron QuickFixSchematron QuickFix 3. QuickFix Conditions ● Conditions – provide a QuickFix only if it makes sense <sch:rule context="head/title"> <sch:assert test="string-length(normalize-space(.)) le 20 " sqf:fix="title"> A title shouldn't have more than 20 characters.</sch:assert> <sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]"> <sqf:description> <sqf:title> Set the title to "<sch:value-of select="//h1[1]"/>". </sqf:title> </sqf:description> <sqf:replace target="title" node-type="element"> <sch:value-of select="//h1[1]"/> </sqf:replace> </sqf:fix> </sch:rule>
  • 30. Schematron QuickFixSchematron QuickFix 3. QuickFix Conditions ● Conditions – provide a QuickFix only if it makes sense <sch:rule context="head/title"> <sch:assert test="string-length(normalize-space(.)) le 20 " sqf:fix="title"> A title shouldn't have more than 20 characters.</sch:assert> <sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]"> <sqf:description> <sqf:title> Set the title to "<sch:value-of select="//h1[1]"/>". </sqf:title> </sqf:description> <sqf:replace target="title" node-type="element"> <sch:value-of select="//h1[1]"/> </sqf:replace> </sqf:fix> </sch:rule>
  • 31. Schematron QuickFixSchematron QuickFix 3. QuickFix Conditions ● Conditions – provide a QuickFix only if it makes sense <sch:rule context="head/title"> <sch:assert test="string-length(normalize-space(.)) le 20 " sqf:fix="title"> A title shouldn't have more than 20 characters.</sch:assert> <sqf:fix id="title" use-when="//h1[1][string-length(.) le 20]"> <sqf:description> <sqf:title> Set the title to "<sch:value-of select="//h1[1]"/>". </sqf:title> </sqf:description> <sqf:replace target="title" node-type="element"> <sch:value-of select="//h1[1]"/> </sqf:replace> </sqf:fix> </sch:rule>
  • 32. Schematron QuickFixSchematron QuickFix 4. Dynamic QuickFixes ● Dynamic QuickFixes – in the future <sch:rule context="head/title"> <sch:assert test="string-length(normalize-space(.)) le 20 " sqf:fix="title"> A title shouldn't have more than 20 characters.</sch:assert> <sqf:fix id="title" use-for-each="//h1[string-length(.) le 20]"> <sqf:description> <sqf:title> Set the title to "<sch:value-of select="$sqf:current"/>". </sqf:title> </sqf:description> <sqf:replace target="title" node-type="element"> <sch:value-of select="$sqf:current"/> </sqf:replace> </sqf:fix> </sch:rule>
  • 33. Schematron QuickFixSchematron QuickFix 5. Call QuickFixes <sqf:fix id="title"> <sqf:call-fix ref="createElementRowAsFirstChild"> <sqf:with-param name="match" select="."/> <sqf:with-param name="el" select=" 'col' "/> <sqf:with-param name="count" select="count(max(.//tr/count(td|th)))"/> </sqf:call-fix> </sqf:fix> <sqf:fix id="createElementRowAsFirstChild"> <sqf:param name="match" type="node()*"/> <sqf:param name="el" type="xs:QName"/> <sqf:param name="count" type="xs:integer"/> <sqf:description> <sqf:title>Create a row of <sch:value-of select="$count"/> <sch:name path="$el"/> elements as a first child of the <sch:name path="$match"/> element(s).</sqf:title> </sqf:description> <sqf:add match="$match" position="first-child"> <xsl:for-each select="1 to $count"> <xsl:element name="{$el}"/> </xsl:for-each> </sqf:add> </sqf:fix>
  • 34. Schematron QuickFixSchematron QuickFix Call QuickFixes ● In the first draft: ● Just a prototype ● Not really functional ● Improvements of the second draft: ● Multiple sqf:call-fix in one sqf:fix ● Use the description of the called fix → Open discussion
  • 35. Schematron QuickFixSchematron QuickFix Review ● Structure / Reference ● sqf:fix, @id, @use-when, @sqf:fix, sqf:group, sqf:fixes ● Description ● sqf:description, sqf:title, sqf:p ● Activity ● sqf:delete, sqf:replace, sqf:add, sqf:keep, sqf:stringReplace ● Generic ● sqf:call-fix, sqf:with-param, sqf:param, sqf:user-entry, @use-for-each → Only 15 Elements (XSLT 2: 49, Schematron: 21)
  • 36. Schematron QuickFixSchematron QuickFix SQF Implementations ● <oXygen/> XML Editor validation engine http://www.oxygenxml.com ● Escali Schematron engine http://schematron-quickfix.com/escali_xsm.html – Escali Schematron command line tool – Oxygen plugin for invoking Escali Schematron
  • 37. Schematron QuickFixSchematron QuickFix Projects using SQF ● Thieme - publishing company uses a custom framework to create and edit XML documents ● parsX - a product developed by pagina GmbH used to facilitate EPUB production ● ART-DECOR - an open source tool suite that supports SDOs active in the healthcare industry Sample SQF embedded in XSD ● ATX custom framework – used by a major automotive producer
  • 38. Schematron QuickFixSchematron QuickFix Projects using SQF ● Dynamic Information Model (DIM) - an implementation of an intelligent style guide ● Schematron for TEI - collection of Schematron and SQF resources for TEI ● <oXygen/> DITA framework - built-in framework in <oXygen/> XML Editor for DITA documents ● <oXygen/> XML userguide - the public version of the <oXygen/> User Manual
  • 39. Schematron QuickFixSchematron QuickFix Conclusions and Future Plans ● SQF is a simple and useful language ● Helps users to solve the problems in less time and with fewer (no) errors ● Update the SQF specification ● Publish the second draft of the Schematron QuickFix specification
  • 40. Schematron QuickFixSchematron QuickFix Thank you! Questions? contact@schematron-quickfix.com @nkutsche octavian_nadolu@oxygenxml.com @OctavianNadolu