Page 1 of 1
How to filter the dita file on the basis of the value of an attribute.
Posted: Wed Apr 13, 2022 9:08 pm
by shiney_98
How to filter the dita file on the basis of the value of an attribute so that intermediateXMl has only specified topics.
Suppose I have an attribute named product with the value of true and false in oxygen editor. I apply both product = true and product = false for two different topics.
While publishing the bookmap with these two topics, I want the intermediateXMl.xml file to show only the topic content with the attribute value "product=true" and remove the other topic which has the attribute value "product=false"
Is there a way to describe a code in xsl for this scenario to be added in dita-to-intermediate.xsl
Re: How to filter the dita file on the basis of the value of an attribute.
Posted: Thu Apr 14, 2022 7:02 am
by Radu
Hi,
The DITA standard indeed defines a set of profiling attributes:
https://www.oxygenxml.com/dita/1.3/spec ... dproc.html
It also defines the contents of a "DITAVAL" filter file which can be used to filter content based on those attributes:
https://www.oxygenxml.com/dita/1.3/spec ... l-val.html
Most of the times DITA content is published using a tool named the "DITA Open Toolkit". Oxygen comes bundled with a customized DITA Open Toolkit but you can also download it as it is an open source project. And when publishing using the DITA Open Toolkit there is a "filter" stage during publication which applies the DITAVAL filter file over the DITA content and removes excluded content.
If you are publishing DITA content from Oxygen using its bundled DITA Open Toolkit publishing engine there are two past webinar recordings here about profiling:
https://www.oxygenxml.com/working_with_ ... xygen.html
If you are using your own custom XSLT stylesheet and apply it directly on DITA content I guess you need to re-implement profiling with your own code.
Regards,
Radu
Re: How to filter the dita file on the basis of the value of an attribute.
Posted: Thu Jan 30, 2025 9:52 am
by horisonten
Building upon this question.
Is there a way or workaround for filtering the actual attributes on elements?
Use case:
Say I have a Bookmap which I'm reusing in multiple manuals. But this Bookmap has some differences in filtering depending on if the output format is PDF or HTML. For example: In the HTML I need to have toc="yes" but in the PDF I need to have toc="no". Is there a way to have both toc="yes" and toc="no" set on the Bookmap, and somehow filter which one to include based on if the output is HTML or PDF?
Currently I need to add the exact same Bookmap twice to be able to have different toc="XX" values.
Re: How to filter the dita file on the basis of the value of an attribute.
Posted: Thu Jan 30, 2025 10:08 am
by Radu
Hi,
There is no such support when using ditaval filter files. Some people may create separate DITA Maps for PDF and HTML outputs. Others may attempt to create some kind of publishing customization in order to control in one of the outputs better how a certain element is handled.
Regards,
Radu