Conditions not working from book level ditaval file

26 views
Skip to first unread message

mr.uma...@gmail.com

unread,
Sep 17, 2021, 5:38:19 AM9/17/21
to DITA-OT Users
Hi,

I have the following book structure:
<bookmap>
    <booktitle>
        <mainbooktitle>Filter Testing</mainbooktitle>
    </booktitle>
    <frontmatter>
        <ditavalref href="filter-test/conditions.ditaval" format="ditaval"/>
    </frontmatter>
    <chapter>
        <topicmeta>
            <navtitle>Chapter Tres</navtitle>
        </topicmeta>
        <ditavalref href="filter-test/conditions.ditaval" format="ditaval"/>
        <topicref href="filter-test/topics/task/task-2.dita"/>
        <topicref href="filter-test/topics/concept/concept-2.dita"/>
    </chapter>
</bookmap>

My Topic "filter-test/topics/concept/concept-2.dita" has following paras:
<p platform="first-prod">This para is only for First Product.</p>
<p platform="second-prod">This para is only for  Second Product.</p>

DITAVAL file has following conditions:
<val>
    <prop action="exclude" att="platform"/>
    <prop action="include" att="platform" val="second-prod"/>
</val>

At first, I included my ditaval file only in <frontmatter> (highlighted in red). But the conditions did not work in my topic. I could see both paras in the HTML (HTML5 transformation in Oxygen Author 21.1) output. Then I moved it to the chapter (highlighted in green). Now, the conditions are working properly and I could see only 2nd para.

My questions:
  1. Is this expected behavior by DITA-OT?
  2. If yes, then I have to include my ditaval file(s) in every chapter to make them work.
  3. That brings another question: what is the purpose of ditaval file in frontmatter?
  4. Am I doing anything wrong?
Your help/guidance is deeply appreciated.

Thanks in advance.

Best Regards,
Uma Shankar

Radu Coravu

unread,
Sep 17, 2021, 5:49:46 AM9/17/21
to mr.uma...@gmail.com, DITA-OT Users
Hi Uma,

The behavior is correct, a ditavalref put inside a frontmatter element takes effect only on the descendant topicrefs inside that frontmatter, not in the entire bookmap.
And with DITA 1.3 you cannot put a ditavalref as a child of the bookmap element.
But with the DITA 2.0 standard you can, something like this is valid:

   <!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA 2.x BookMap//EN" "bookmap.dtd">
   <bookmap>
       <booktitle>
           <mainbooktitle></mainbooktitle>
       </booktitle>
     <ditavalref>....</ditavalref>
   </bookmap>     

The DITA 2.0 standard was not yet officially released but the DTDs are part of the DITA OT 3.6, so if you use DITA OT 3.6 the bookmap sample I gave above which refers to the DITA 2.0 DTDs should be valid and it might also work when published.

Regards,
Radu

--
You received this message because you are subscribed to the Google Groups "DITA-OT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dita-ot-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dita-ot-users/39d20f0e-c1df-48fc-af01-7122d68e0e82n%40googlegroups.com.

Radu Coravu

unread,
Sep 17, 2021, 5:51:16 AM9/17/21
to mr.uma...@gmail.com, DITA-OT Users

Uma Shankar

unread,
Sep 17, 2021, 8:55:44 AM9/17/21
to Radu Coravu, DITA-OT Users
Hi Radu,

Thanks for the prompt reply.

So, is the "inability to allow user to define a book level ditaval file" a bug/limitation in DITA 1.0?
--
Best Regards,
Uma Shankar

Uma Shankar

unread,
Sep 17, 2021, 9:03:22 AM9/17/21
to Radu Coravu, DITA-OT Users
** Correction **

So, is the "inability to allow users to define a book level ditaval file" a bug/limitation in DITA 1.01.3?

Chris Papademetrious

unread,
Sep 17, 2021, 10:35:30 AM9/17/21
to DITA-OT Users
Hi Radu,

I am definitely looking forward to this DITA 2.0 ability of books to self-declare their global DITAVAL conditions!


Hi Uma,

We run into this same limitation too. We do a couple of things to work around it.

First, we use DITA project files to define book contexts:


A context lets you associate a DITAVAL file with a map:

  <context id="context-mybook" name="mybook">
    <input href="mybook.ditamap"/>
    <profile>
      <ditaval href="filter-test/conditions.ditaval"/>
    </profile>
  </context>


You can then define publications that publish these contexts. If you are using Oxygen, you can add your DITA project to the Main Files list and it will present only map-relevant contexts in the DITA Maps Manager, which is quite handy when you have many books and filtering conditions (as we do). We do not use project files for publishing; we use them only to inform Oxygen of our bookmap/DITAVAL associations.

Another method is to create an intermediate "wrapper map" (not a bookmap) that does nothing more than instantiate a bookmap in a particular condition:

<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="urn:oasis:names:tc:dita:rng:map.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
<map>
  <title>My Book Title</title>
  <ditavalref href="_warehouse/_ditaval/filter_synthesis_FC.ditaval"/>
  <mapref href="mybook.ditamap"/>
</map>

You must redefine your book title in this wrapper map, as the topmost title in the map hierarchy is used for publication. You will need to test this method in your publishing environment to see if it works. Oxygen's PDF Chemistry does supports wrapper maps, and it renders book structures correctly. We use wrapper maps to create multiple conditional versions of a book from a single-sourced shared map. We can then include these conditional books (via their wrapper maps) in higher-level online help collections.

Note that to use these "wrapper maps," you must use DITA-OT 3.6 or later to get a required bug fix.

 - Chris
Reply all
Reply to author
Forward
0 new messages