Schematron quick fix to add and element and an attribute
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 316
- Joined: Wed Jun 17, 2015 10:19 am
Schematron quick fix to add and element and an attribute
Post by ann.jensen »
Hi,
I think I am trying to do something simple with Schematron and quick fixes but struggling.
I want to check for a given element and if it doesn't exist, then I want to add it and its required attribute.
I know I need
to add the missing element (resourceid) but not sure how I also add the required attribute name and value (appname="abc") in the same fix.
Any advice appreciated,
Regards,
Ann
I think I am trying to do something simple with Schematron and quick fixes but struggling.
I want to check for a given element and if it doesn't exist, then I want to add it and its required attribute.
I know I need
Code: Select all
<sch:rule context="prolog">
<sch:assert test="resourceid" sqf:fix="addResource">ResourceId element is missing. </sch:assert>
<sqf:fix id="addResource">
<sqf:description><sqf:title>Add resourceId inside prolog</sqf:title></sqf:description>
<sqf:add target="resourceid" node-type="element" position="last-child"></sqf:add>
</sqf:fix>
</sch:rule>
to add the missing element (resourceid) but not sure how I also add the required attribute name and value (appname="abc") in the same fix.
Any advice appreciated,
Regards,
Ann
-
- Posts: 9438
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Schematron quick fix to add and element and an attribute
Hi Ann,
Maybe you can take a look at my "addProlog" quick fix from the Oxygen XML Blog project:
https://github.com/oxygenxml/blog/blob/ ... /rules.sch
Regards,
Radu
Maybe you can take a look at my "addProlog" quick fix from the Oxygen XML Blog project:
https://github.com/oxygenxml/blog/blob/ ... /rules.sch
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 316
- Joined: Wed Jun 17, 2015 10:19 am
Re: Schematron quick fix to add and element and an attribute
Post by ann.jensen »
Thank you very much Radu, that explains it.
Regards,
Ann
Regards,
Ann
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