Page 1 of 1
Customizing elements and attributes
Posted: Thu Jun 22, 2023 2:23 pm
by SunilCP
Hello All,
How do I customize the concept.dtd file?
I want my writers not to use certain elements. That particular element should not display in the list of elements that my writer can select.
For example, in the concept topic, <shortdesc> element should not be available for my writers to select and use.
Also, how to customize the attributes for any elements?
Any insights on how to control these?
Re: Customizing elements and attributes
Posted: Thu Jun 22, 2023 3:14 pm
by chrispitude
Hi Sunil,
You can configure a
cc_config_ext.xml file as described here:
Configuring the Proposals for Elements and Attributes
then add an entry like this:
Code: Select all
<elementProposals rejectElements="shortdesc"/>
If you want a quick way to experiment with this, you can use the testcase provided
here. It was made to test a different behavior, but it still provides an extended framework with a
cc_config_ext.xml file that is ready for you to experiment with.
Re: Customizing elements and attributes
Posted: Fri Jun 23, 2023 6:17 am
by Radu
Hi,
There is also the possibility to create a DTD specialization plugin, there are some tutorials linked here, but it's something which takes time:
https://www.oxygenxml.com/doc/versions/ ... ation.html
Other than that, as Chris says, you can filter certain elements from being used directly from Oxygen with a framework customization, either with a content completion configuration file or by adding that element in a special list of elements which should be removed from the content completion:
https://blog.oxygenxml.com/topics/custo ... etion.html
About this:
Also, how to customize the attributes for any elements?
If you just want to control attribute values, you can do that with a content completion configuration file or with a Subject Scheme map:
https://blog.oxygenxml.com/topics/contr ... alues.html
If you want to add new attributes then you would need to create a DTD specialization plugin.
Regards,
Radu
Re: Customizing elements and attributes
Posted: Fri Jun 23, 2023 12:08 pm
by chrispitude
Hi Sunil,
If you are open to using a RelaxNG grammar instead of a DTD grammar, you could use
make_dita_grammar.pl, located here:
chrispy-snps/DITA-plugin-utilities (github.com)
with an input file like this:
Code: Select all
<plugin directory="./com.mycompany.docshell" uri_prefix="com:mycompany:docshell">
<attributedomain filename="paginateAttMod.rng" domain="paginate">
<specialize attribute="paginate" from="base" model="(keep-with-next|keep-with-previous|top-of-page|keep-together|allow-breaks-inside)*"/>
</attributedomain>
<constraint filename="myConstraint.rng" domain="my-c">
<include_domains>topic hi-d indexing-d sw-d pr-d ui-d ut-d mathml-d deliveryTarget paginate</include_domains>
<allow domain="hi-d" elements="sup sub"/>
<disallow elements="shortdesc vrm vrmlist"/>
</constraint>
<topicshell filename="myGlossaryShell.rng">
<title>My Glossary</title>
<root_element>glossgroup</root_element>
<include_domains>my-c glossgroup glossentry</include_domains>
</topicshell>
<topicshell filename="myTopicShell.rng">
<title>My Topic</title>
<root_element>topic</root_element>
<include_domains>my-c</include_domains>
</topicshell>
</plugin>
In the constraint module definition, the
<disallow> element disallows the specified elements in the grammar. The
<allow> element allows only certain elements from a domain, disallowing all other elements in that domain.
This example also specializes a
@paginate attribute with certain predefined values.