DITAVAL to Exclude Items That Are Missing an Attribute

Post here questions and problems related to editing and publishing DITA content.
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

DITAVAL to Exclude Items That Are Missing an Attribute

Post by jmorales »

We have this DITAVAL file:
<val>
<prop action="exclude" att="product"/>
<prop action="include" att="product" val="acme"/>
</val>

The intent is to include only elements or topics that have product set to acme. The actual behavior is as follows:

- product = "acme" : Included
- product = "zenith" : Excluded
- product attribute is not assigned: Included

How would I exclude topics that do not have any product attribute?

Thanks.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: DITAVAL to Exclude Items That Are Missing an Attribute

Post by Radu »

Hi,

The ditaval filter checks any DITA element starting from the published DITA Map: map elements, topicrefs, topics, elements inside topics, for each of those elements a decision is taken if the element is included or filtered.
You cannot state in the filter that <topic> elements which do not have a certain attribute set on them are excluded, by default the filter is including.
There is a topic in the DITA 1.3 specs which describes how the decision to filter or include a DITA element is taken based on the rules in the DITAVAL file:
https://www.oxygenxml.com/dita/1.3/spec ... ering.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: DITAVAL to Exclude Items That Are Missing an Attribute

Post by jmorales »

Thanks, Radu. You mention "You cannot state in the filter that <topic> elements which do not have a certain attribute set on them are excluded, by default the filter is including." The article at https://www.oxygenxml.com/dita/stylegui ... tions.html states that 'You can change this default inclusive behaviour of the ditaval to exclusive by setting the following property as the first node under the val element in the ditaval file: <prop action="exclude" />'. I tried doing this as follows:

<val>
<prop action="exclude"/>
<prop action="include" att="product" val="acme"/>
</val>

Unfortunately, the effect is that ALL elements are filtered out, regardless of whether they have a product attribute and regardless of the value of that attribute. It seems like the <prop action="exclude"/> will never be useful unless you can override it with an include action for specific attributes or attribute values. Can you explain how to do that? Thanks again!
LATER: After more experiment, I found that the filter shown above works as expected if product is the only attribute on the element. My elements had multiple attributes, and apparently that's why they were all being filtered out. By the way, I don't see a way to delete a message reply from the Oxygen forum. If there is a way, could you let me know.
Radu
Posts: 9057
Joined: Fri Jul 09, 2004 5:18 pm

Re: DITAVAL to Exclude Items That Are Missing an Attribute

Post by Radu »

Hi,

This:

Code: Select all

<prop action="exclude"/> 
means something like:
Exclude all DITA elements which have a profiling attribute set on them, no matter what profiling attribute name and value.
Quote from the DITA 1.3 specification:
https://www.oxygenxml.com/dita/1.3/spec ... -prop.html
@att
The attribute to be acted upon. If using a literal attribute name, it must be one of @props, @audience, @platform, @product, @otherprops, @deliveryTarget, or a specialization of @props. Otherwise, the value should be the name of a group used within the @audience, @platform, @product, or @otherprops attributes. If the @att attribute is absent, then the <prop> element declares a default behavior for any conditional processing attribute.
@val
The value to be acted upon. If the @val attribute is absent, then the <prop> element declares a default behavior for any value in the specified attribute.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jmorales
Posts: 93
Joined: Tue Oct 30, 2018 9:47 pm

Re: DITAVAL to Exclude Items That Are Missing an Attribute

Post by jmorales »

Thanks, Radu!
Post Reply