[oXygen-user] DITA constraints: reject attribute values?
George Bina
george at oxygenxml.com
Thu Feb 15 10:18:12 CST 2018
Dear Yves,
You can control the attribute values from the cc_config.xml file by
either specifying the allowed values for an attribute or provide an XSLT
script that will generate the allowed values, for example that XSLT may
invoke a web service using the document() function or look into the
content of the edited document using two parameters that we pass to that
stylesheet when we execute it:
documentSystemID
contextElementXPathExpression
You can find more details about this at
https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/configuring-content-completion-proposals.html
https://www.oxygenxml.com/doc/versions/19.1/ug-editor/topics/configuring-content-completion-proposals.html
So, for your example you will probably need only a static list of
values, like below:
<match elementName="note" attributeName="type">
<items action="replace">
<item value="warning"><annotation>Mark this note as
warning.</annotation></item>
<item value="caution"><annotation>Mark this note as
caution.</annotation></item>
<item value="tip"><annotation><html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Tip</title></head>
<body>
<h1>Tips</h1>
<p>You can use the <code>tip</code> value to mark this not as a tip.
Read more about oXygen at the <a
href="http://www.oxygenxml.com">oXygen XML website</a>.</p>
</body>
</html></annotation></item>
<item value="notice"><annotation>Mark this note a
notice.</annotation></item>
</items>
</match>
Please note the @action attribute on items, the value "replace" means
that only the specified values will be used. You can use also "append"
or "addIfEmpty" to add values to existing ones or to add values only if
there are no proposals offered otherwise.
For your second request, I think one can generate such a configuration
file using a higher level abstraction, that may allow choosing domains
or different other things. A quick thing may be to create a CSS with
some inline actions and edit the file visually in the oXygen Author mode :).
Best Regards,
George
--
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On 15/02/18 16:31, Yves Barbion wrote:
> Hi group
>
> The cc_config.xml file seems to be handy to apply DITA constraints
> (although I could imagine easier ways, such as some kind of wizard, for
> example).
>
> I see that it is possible to "reject" elements and attributes:
>
> https://www.oxygenxml.com/doc/versions/18/ug-editor/topics/configure-elements-attr-cc-individually.html
>
> But is it also possible to reject attribute *values (without having to
> create a DITA specialization*? For example, suppose I want to restrict
> the list of the @type attribute for the [note] element. I only want to
> see the values: warning, caution, tip and notice and "hide" the others
> (fastpath, restriction, danger, important...)
>
> Is there an easy way to do this? I think it would be nice if we could
> have some kind of wizard which presents us a list of DITA elements and
> attributes (and their values) where we would just select the elements,
> attributes and attribute values we need (using check boxes to select or
> deselect). And we also need to be able to show or hide complete domains,
> similar to what is described in the DITA Style Guide:
>
> https://www.oxygenxml.com/dita/styleguide/webhelp-feedback/#Artefact/Documentation_Process/c_Restricting_Authors.html
>
> (A bit weird to see a screen shot from a wizard in XMetaL published in
> the DITA STyle Guide on the oxygenxml website ;-)).
>
> Thanks
>
> Yves
>
>
>
>
>
>
>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> https://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
More information about the oXygen-user
mailing list