[oXygen-user] About oXygen XML Editor
About oXygen XML Editor
Wed Jul 15 23:44:45 CDT 2015
About oXygen XML Editor
///////////////////////////////////////////
Controlled Attribute Values for your DITA Project
Posted: 15 Jul 2015 03:31 AM PDT
http://feedproxy.google.com/~r/AboutOxygenXmlEditor/~3/AGTBTAnCxA0/controlled-attribute-values-for-your.html?utm_source=feedburner&utm_medium=email
Frequently when editing DITA content you will feel the need to enforce
a controlled set of values when editing certain attributes. For
example you may want to impose that the values for the @outputclass
attribute on the element codeblock are either language-xml or
language-css. This is useful in order to remind writers that any
other value will not be interpreted by the build process in a significant
manner. Oxygen has a couple of easy ways in which controlled values can
be imposed for certain attributes: You can edit the XML
configuration file
OXYGEN_INSTALL_DIR/frameworks/dita/resources/cc_value_config.xml and
provide additional entries. In the case of our small example for
providing controlled values for the @attribute the configuration
file should contain an additional entry:<match
elementName="codeblock" attributeName="outputclass">
<items action="addIfEmpty">
<item value="language-xml" annotation="XML Syntax Highlight"/>
<item value="language-css" annotation="CSS Syntax Highlight"/>
</items>
</match>Besides providing a hard-coded list of values the content
completion configuration file is flexible enough to allow calling
an XSLT stylesheet which could retrieve those values from other
sources (for example via HTTP from an Exist database). Provide
those controlled values via a Subject Scheme Map (my favorite). Coming back
to our example, you can create a small Subject Scheme map with
the file name controlledValues.ditamap and the
content:<!DOCTYPE subjectScheme PUBLIC "-//OASIS//DTD DITA Subject Scheme
Map//EN""map.dtd">
<subjectScheme>
<subjectHead>
<subjectHeadMeta>
<navtitle>Provide controlled attributes</navtitle>
</subjectHeadMeta>
</subjectHead>
<hasInstance>
<subjectdef keys="languageTypeKey">
<subjectdef keys="language-xml">
<topicmeta>
<navtitle>XML Syntax Highlight</navtitle>
</topicmeta>
</subjectdef>
<subjectdef keys="language-css">
<topicmeta>
<navtitle>CSS Syntax Highlight</navtitle>
</topicmeta>
</subjectdef>
</subjectdef>
</hasInstance>
<enumerationdef>
<elementdef name="codeblock"/>
<attributedef name="outputclass"/>
<subjectdef keyref="languageTypeKey"/>
</enumerationdef>
</subjectScheme>then you can refer to it from your main DITA
Map like:<topicref href="controlledValues.ditamap"
format="ditamap" type="subjectScheme"/> If the attributes on which
you want to impose certain values are DITA profiling attributes, you can go
to the Oxygen Preferences->Editor / Edit modes / Author /
Profiling/Conditional Text page and define the set of allowed
values for them. The only problem with the first approach is the
fact that validation will not impose those values and writers will
not receive validation error messages if they set another value for
the specific attribute. So you will probably need to add a Schematron check
in order to signal errors when a certain attribute's value does not
match the list of controlled attribute values. For both the second
and third approaches, validation will warn the writers if certain
attribute values do not match values in the controller values list.
--
You are subscribed to email updates from "About oXygen XML Editor."
To stop receiving these emails, you may unsubscribe now:
https://feedburner.google.com/fb/a/mailunsubscribe?k=y_tRXtumvTurKTedh51JnlYsGXw
Email delivery powered by Google.
Google Inc., 1600 Amphitheatre Parkway, Mountain View, CA 94043, United
States
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-user/attachments/20150716/fcb05389/attachment.html>
More information about the oXygen-user
mailing list