In Schematron quick-fix XSLT, can default attributes be suppressed?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
In Schematron quick-fix XSLT, can default attributes be suppressed?
Post by chrispitude »
I have a Schematron quick-fix that adds <glossAcronym> and <glossSurfaceForm> to a <glossEntry>. It does this by calling a small bit of XSLT to update the <glossEntry>.
When I run the quick-fix on this:
the result is this:
The newly added elements (<glossBody> and down) are fine. But the existing copied elements (<glossentry>, <glossterm>, and <glossdef>) get explicit copies of the normally-implicit attributes.
For now, I will add more refactoring code to strip them out, but it would be nice if this could somehow be handled automatically (if possible).
Testcase:
To run,
When I run the quick-fix on this:
Code: Select all
<glossgroup id="glossary">
<title>My Glossary</title>
<glossentry id="ddl">
<glossterm>DITA</glossterm>
<glossdef>This is some definition text.</glossdef>
</glossentry>
</glossgroup>
Code: Select all
<glossgroup id="glossary">
<title>My Glossary</title>
<glossentry class="- topic/topic concept/concept glossentry/glossentry "
ditaarch:DITAArchVersion="1.3"
domains="(topic abbrev-d) (topic concept glossentry) (topic concept glossgroup) (topic concept) (topic equation-d) (topic hazard-d) (topic hi-d) (topic indexing-d) (topic markup-d xml-d) (topic markup-d) (topic mathml-d) (topic pr-d) (topic relmgmt-d) (topic svg-d) (topic sw-d) (topic ui-d) (topic ut-d) a(props deliveryTarget)"
id="ddl">
<glossterm class="- topic/title concept/title glossentry/glossterm "/>
<glossdef class="- topic/abstract concept/abstract glossentry/glossdef ">This is some
definition text.</glossdef>
<glossBody>
<glossSurfaceForm/>
<glossAlt id="glossAlt_abf_sws_bzb">
<glossAcronym>DITA</glossAcronym>
</glossAlt>
</glossBody>
</glossentry>
</glossgroup>
For now, I will add more refactoring code to strip them out, but it would be nice if this could somehow be handled automatically (if possible).
Testcase:
oxygen-glossary-2.zip
To run,
- Open the project file.
- Open the glossary.dita file.
- Apply a Schematron quick-fix to the glossary term.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: In Schematron quick-fix XSLT, can default attributes be suppressed?
Post by chrispitude »
This removed the superfluous attributes:
Code: Select all
<xsl:template match="@class|@domains|@*:DITAArchVersion" mode="fix-glossterm-acronym"/>
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: In Schematron quick-fix XSLT, can default attributes be suppressed?
Hello,
Thanks for your feedback.
The solution that you found is good. We cannot determine in XSLT the default attributes for an element. All the attributes will be copied and you need to filter them. We have a similar example in the samples project ([oxygenInstallDir]\samples\quick-fixes\flowers.sch).
Best Regards,
Octavian
Thanks for your feedback.
The solution that you found is good. We cannot determine in XSLT the default attributes for an element. All the attributes will be copied and you need to filter them. We have a similar example in the samples project ([oxygenInstallDir]\samples\quick-fixes\flowers.sch).
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: In Schematron quick-fix XSLT, can default attributes be suppressed?
Post by chrispitude »
Thanks Octavian! The fix proved to be simple and compact. And when using a refactoring operation in Schematron like this, I will always use a moded template to apply the fix, so it is no problem. Now this discussion can document the solution for others. 

Return to “DITA (Editing and Publishing DITA Content)”
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