Pages: 1
Print
Author Topic: Possible to use conditions for different chapters of same book?  (Read 3303 times)
1023
Member

Posts: 5


« on: June 08, 2010, 11:34:42 AM »

I'm creating a bookmap in DITA. Several of the chapters reuse much of the same content, but each chapter is specific to a different product, so only one or two words change.

For example, a paragraph in chapter 1 may say, "The X card is based on the following items." Chapter 2 has the same sentence, but lists a different product name, "The Y card is based on the following items."

I've used conrefs for as much of the text as possible, but I'm wondering if there's a way to add conditions for the few words that differ. I'm only familiar with conditions being used for multiple book outputs, and am not sure if there's a way to specify text to output with certain chapters of the same book output.
Logged
gcrews
Member

Posts: 265


« Reply #1 on: June 08, 2010, 02:51:01 PM »

Sounds like the same issue I had about a month ago when I needed to conditionally process different things in same deliverable. I asked on the dita-users forum and got a bunch of good feedback.
http://tech.groups.yahoo.com/group/dita-users/message/18259

What I ended up doing was to create a build run that first compiles a map though a new target I created that filters the content with a datival. The filtered xml files get placed in a folder where I can then run my final compile on and it will pull in the conditionally processed files into the final. It’s a bit of a kluge but it works for us for the current time being. It seems like dita 1.2 may have some ways to get this done.

Here is the target I made that just filters the files and copies any referenced images:
<target name="dita2preCtFiles" unless="noMap" depends="
   build-init,
   clean-temp,
   debug-filter,
   copy-files,
   copyCtFiles" >
</target>         
 <target name="copyCtFiles">
   <copy todir="${output.dir}">
     <fileset dir="${dita.temp.dir}" includes="**/*.ditamap" casesensitive="no" />
     <fileset dir="${dita.temp.dir}" includes="**/*.xml" casesensitive="no" />
</copy>
</target>
Logged
1023
Member

Posts: 5


« Reply #2 on: June 09, 2010, 07:21:40 AM »

Thanks for the suggestion! I'll give it a try.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: June 09, 2010, 12:40:58 PM »

I think very likely the ultimate solution to this (assuming I understand what is described here) is the DITA 1.2 "keyref" attribute and associated functionality. A few things need to fall into place before that can be done though, with the DITA OT being the main one obviously.

If you want to work on the bleeding edge (and perhaps ideally you also have a second computer or virtual machine you can muck around with) you might check this out: http://forums.xmetal.com/index.php/topic,747.0.html

I'm not sure what the support in the DITA OT that comes with that is like for "keyref", but as far as editing is concerned you get the 1.2 version of the DTDs. This "configuration kit" doesn't add any special UI helpers for inserting the new 1.2 stuff, so you will be working in the Element List and Attribute Inspector when it comes to that.
Logged
Su-Laine Yeo
Solutions Consultant
Member

Posts: 260


« Reply #4 on: June 16, 2010, 12:20:41 PM »

I don't think the DITA 1.2 keyref feature, or any other feature of DITA 1.2, would be of use for this particular scenario. The draft DITA 1.2 spec says, "A root map and its directly addressed, local scope descendant maps establish a unique key space within which each unique key name has exactly one binding to a set of resources." In other words, you can't define a key in different ways for different chapters within a bookmap.

I did some testing with DITA Open Toolkit 1.5 and its behaviour was consistent with what the spec says. The ideas that gcrews suggests are your best bet.

Cheers,
Su-Laine
Logged

Su-Laine Yeo
Solutions Consultant
JustSystems Canada, Inc.
Pages: 1
Print
Jump to: