Kazuko O. wrote:
I would like to ask you if xxe can use schematron for dita files.
I tried to apply the following schematron to xxe as an addon, but I failed.
-------------
<pattern>
<rule context="*[contains(@class, ' topic/title ')]">
<report test="b" role="error">Do not insert b element into title
element.</report>
</rule>
</pattern>
--------------
If possible, would you let me know how I set the schematron for dita?
1) Please create a schematron file (typically having a ".sch" suffix)
containing your pattern.
For example, "business_rules.sch":
---
<?xml version="1.0" encoding="UTF-8"?>
<sch:schema queryBinding="XSLT"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<sch:pattern>
<sch:rule context="title">
<sch:report test=".//b" role="error">Do not insert b element into
title element.</sch:report>
</sch:rule>
</sch:pattern>
</sch:schema>
---
===================================================================
Note that
1) I'm not using the default namespace prefix for schematron, but for
DITA elements.
2) I have replaced context="*[contains(@class, ' topic/title ')]" by
context="title".
The ' topic/title ' substring is possibly found in the default value of
the class attribute of a DITA element. When editing a document in XXE,
default attribute values are always discarded. Therefore something like
context="*[contains(@class, ' topic/title ')]" cannot work.
===================================================================
2) Add a <schematron> configuration element preferably to your
customization of the DITA topic configuration. See
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/schematron.html
Example:
---
<schematron location="business_rules.sch" />
---
Please note that adding <schematron> configuration element to a
"customize.xxe" file simply cannot work. You really need to add this
configuration element to the DITA topic configuration, whether stock or
custom.
The stock DITA topic configuration is found in:
XXE_INSTALL_DIR/addon/config/dita/topic.xxe
How to create a customization of the DITA topic configuration is pretty
simple. Please follow the instructions found in "5. Customizing an
existing configuration",
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/customizing.html
(Please use "0topic.xxe" as your template,
http://www.xmlmind.com/xmleditor/_distrib/doc/configure/samples/customize/dita/0topic.xxe)
--
XMLmind XML Editor Support List
xmleditor-support@xmlmind.com
http://www.xmlmind.com/mailman/listinfo/xmleditor-support