DITAblogs (customizing)

Our experience with default CSS behavior

In the Ant scripts used to build the DITA Open Toolkit User Guide, we initially used only the default CSS stylesheet. However, the default CSS for XHTML does not have a filepath class defined, so all <filepath> elements are unstyled. For this reason we have added a custom CSS file that styles .filepath using the Courier font family. Here is what the CSS file looks like:

/* Stylesheet overrides for DITA Open Toolkit User Guide */

/* DITAOT_UGRef_CSS.css */

.filepath { font-family: courier }

Note: We recently commented out this change, because we didn't like the way it looks in the XHTML output. However, this example is still a good illustration of how to make this kind of customization.

Garage sample files that illustrate filtering

One of the Ant scripts for the garage sample uses filtering to exclude topics having to do with oil and snow. The garage batch file that kicks off the processing (runbuild.bat) and the garage Ant script (garage_hierarchy_all.xml) are set up to do the filtering.

To run the build:
			runbuild dita2filtered
Here is the section of the Ant script that references the .ditaval file:
<!-- Specify the ditaval file to be used for filtering -->
<!-- -->
<!-- To turn on filtering, you first need to change the following ditaval file to include the filter.
See the ditaval file for instructions.
Then run the Ant script with the dita2filtered target name. 
Example (using the batch to call the Ant script): runbuild dita2filtered hierarchy -->
<!-- -->
<property name="dita.input.valfile" value="${projdir}/ditaval_files/garage_filtering.ditaval"/>
Here is the map file that uses the <otherprops> element to identify topics having to do with oil and snow:
<map title="Garage (hierarchy)">
<topicref href="concepts/garagetasks.dita" format="dita">
<topicref href="tasks/changingtheoil.dita" otherprops="oil" format="dita"/>
<topicref href="tasks/organizing.dita" format="dita"/>
<topicref href="tasks/shovellingsnow.dita" otherprops="snow" format="dita"/>
<topicref href="tasks/takinggarbage.dita" format="dita"/>
<topicref href="tasks/spraypainting.dita" format="dita"/>
<topicref href="tasks/washingthecar.dita" format="dita"/>
<topicref href="concepts/garageconcepts.dita" format="dita">
<topicref href="concepts/lawnmower.dita" format="dita"/>
<topicref href="concepts/oil.dita" otherprops="oil" format="dita"/>
<topicref href="concepts/paint.dita" format="dita"/>
<topicref href="concepts/shelving.dita" format="dita"/>
<topicref href="concepts/snowshovel.dita" otherprops="snow" format="dita"/>
<topicref href="concepts/toolbox.dita" format="dita"/>
<topicref href="concepts/tools.dita" format="dita"/>
<topicref href="concepts/waterhose.dita" format="dita"/>
<topicref href="concepts/wheelbarrow.dita" format="dita"/>
<topicref href="concepts/workbench.dita" format="dita"/>
<topicref href="concepts/wwfluid.dita" format="dita"/>
Here is the .ditaval file, which is referenced in the Ant script, that excludes topics tagged as having to do with oil or snow:
<?xml version="1.0" encoding="utf-8"?>
<!-- Filters out topics about "oil" and "snow" from the garage sample. -->
<prop att="otherprops" val="oil" action="exclude"></prop>
<prop att="otherprops" val="snow" action="exclude"></prop>