Using SQF on Schematron files
Oxygen general issues.
-
- Posts: 57
- Joined: Tue Jul 21, 2009 1:48 am
Using SQF on Schematron files
I'm trying to create a Schematron Quickfix to enforce the authoring standards on our Schematron files. Works great until I needed to add a schematron element because the SQF can't tell the element I was trying to add wasn't just Schematron needing evaluation. Example, the following (obviously wrong) SQF rule tries to add a element <sch:value-of select='$DIAGNOSTIC_FOOTER'> into the schematron document being fixed (in bold below), but of course it just gets evaluated because it's schematron. I know t XSLT uses a namespace-alias for this sort of thing, what's the approach in this case?
Thanks Scott
<sch:pattern id="sqf-add-diag-ft">
<sch:rule context="sch:assert | sch:report">
<sch:assert test="sch:value-of[@select = '$DIAGNOSTIC_FOOTER']" sqf:fix="sqf-add-diag-ft" role="error" id="sch0004"><sch:name/> should have value-of for the diagnostic footer .</sch:assert>
<sch:let name="var-name" value="'$DIAGNOSTIC_FOOTER'"></sch:let>
<sqf:fix id="sqf-add-diag-ft">
<sqf:description>
<sqf:title>Add diagnostic footer</sqf:title>
</sqf:description>
<sqf:add position="last-child" xml:space="preserve">
<sch:value-of select="$var-name"/></sqf:add>
</sqf:fix>
</sch:rule>
</sch:pattern>
Thanks Scott
<sch:pattern id="sqf-add-diag-ft">
<sch:rule context="sch:assert | sch:report">
<sch:assert test="sch:value-of[@select = '$DIAGNOSTIC_FOOTER']" sqf:fix="sqf-add-diag-ft" role="error" id="sch0004"><sch:name/> should have value-of for the diagnostic footer .</sch:assert>
<sch:let name="var-name" value="'$DIAGNOSTIC_FOOTER'"></sch:let>
<sqf:fix id="sqf-add-diag-ft">
<sqf:description>
<sqf:title>Add diagnostic footer</sqf:title>
</sqf:description>
<sqf:add position="last-child" xml:space="preserve">
<sch:value-of select="$var-name"/></sqf:add>
</sqf:fix>
</sch:rule>
</sch:pattern>
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Using SQF on Schematron files
Hi Scott,
In this case you can use the "xsl:element" and "xsl:attribute" to generate the content. Something like this"
Best Regards,
Octavian
In this case you can use the "xsl:element" and "xsl:attribute" to generate the content. Something like this"
Code: Select all
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<sch:ns uri="http://purl.oclc.org/dsdl/schematron" prefix="sch"/>
<sch:pattern id="sqf-add-diag-ft">
<sch:rule context="sch:assert | sch:report">
<sch:assert test="sch:value-of[@select = '$DIAGNOSTIC_FOOTER']"
sqf:fix="sqf-add-diag-ft" role="error" id="sch0004"><sch:name/> should have value-of
for the diagnostic footer .</sch:assert>
<sch:let name="var-name" value="'$DIAGNOSTIC_FOOTER'"/>
<sqf:fix id="sqf-add-diag-ft">
<sqf:description>
<sqf:title>Add diagnostic footer</sqf:title>
</sqf:description>
<sqf:add position="last-child">
<xsl:element name="sch:value-of">
<xsl:attribute name="select" select="$var-name"/>
</xsl:element>
</sqf:add>
</sqf:fix>
</sch:rule>
</sch:pattern>
</sch:schema>
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 57
- Joined: Tue Jul 21, 2009 1:48 am
Re: Using SQF on Schematron files
Thanks for that... I tried that earlier but I think I was seeing error results from a previous iteration when I did the QF - have to remember to re-validate the document before trying the QF again. Just getting started with SQF so getting a few lessons as I go. Excited about using it now!
-
- Posts: 57
- Joined: Tue Jul 21, 2009 1:48 am
Re: Using SQF on Schematron files
Speaking of lessons... found another problem too - xml:space="preserve" doesn't work on the sqf:add if using the xsl:
Could not generate quick fix 'sqf-add-diag-ft'
I think this is what I may have been seeing before. Removing it and formatting with xsl:text gets things to work.
Could not generate quick fix 'sqf-add-diag-ft'
I think this is what I may have been seeing before. Removing it and formatting with xsl:text gets things to work.
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