Topics

Branch filtering on reused content #conditional-processing

Pieterjan Vandenweghe
 

Hi,

I am currently trying to figure out the branch filtering mechanism, but I am lost when it comes to branch filtering and reused content.
Is it possible to do branch filtering on reused content?

I will try to explain my problem with an example.

I created the following sample ditamap:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title>Ditaval test</title>
<topicref href="ta_ditavalref.dita" navtitle="Ditavalref">
<ditavalref href="branchfiltering.ditaval" format="ditaval"/>
</topicref>
<topicref href="to_reuse.dita" processing-role="resource-only"/>
</map>

In the topic ta_ditavalref.dita I have the following sample text (see also: attached branch_filtering.png).
In the conreffed items I added extra filtering attributes.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE task PUBLIC "-//FLOW BV//DTD Agilent DITA specialization task//EN" "task.dtd">
<task id="ta_ditavalref" xml:lang="en-US">
<title>Branch filtering</title>
<taskbody>
<context>
<p conref="to_reuse.dita#untitled1/p_u4r_jwz_rkb" id="p_wn1_twz_rkb"/>
</context>
<steps>
<step audience="expert">
<cmd>This is for experts</cmd>
</step>
<step audience="novice">
<cmd>This is for novices.</cmd>
</step>
</steps>
</taskbody>
</task>

This is the reuse.dita file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="untitled1">
<title>Warehouse</title>
<prolog/>
<body>
<p id="p_u4r_jwz_rkb">This information depends on the audience: <ph audience="expert">Expert</ph>
<ph audience="novice">Novice</ph></p>
</body>
</topic>
 


When I process these files to PDF/HTML and exclude audience="novice" via branch-filtering, the branch-filtering works fine on the filtering attributes which are present in the topic itself, ie. the two steps.
However the branch filtering doesn't work on the 'conreffed' item in my reuse.dita file. Both <ph> elements are published (see branch_filtering_pdf.png).

Is it possible to get this working on the conreffed items too? How should I change my structure to get this done?
Please find attached my sample DITAMAP for reference.

In my current project I need to add a similar DITAMAP twice in one publication, once with info for the experts and once with for the novices.
If possible I would like to use branch filtering.

Thanks a lot for your help in advance.

Kind regards,
Pieterjan




Radu Coravu
 

Hi Pieterjan,

It probably depends on the order in which the DITA OT engine does the branch filtering and the conref resolution.
From what I looked it seems to first do the filtering and then the conref resolution.
In my opinion maybe something like this would work:

<topicref href="ta_ditavalref.dita" navtitle="Ditavalref">
<ditavalref href="branchfiltering.ditaval" format="ditaval"/>
<topicref href="to_reuse.dita" processing-role="resource-only"/>
</topicref>
 

otherwise you may need to define a key scope, define a key for the topic and use conkeyref in the topic.

Regards,
Radu

Pieterjan Vandenweghe
 

Hi Radu,

Defining keyscopes and keys for each topic did the trick.
Thank you for the tip.  

Kind regards,

Pieterjan