D IT A example
Inside the root document
element in the document
file, insert a path
element if it is not already there.
The example in this task configures two references. After following this two examples, you should be able to configure the other references yourselves. The examples are the following:
-
All elements that have a
href
attribute and aformat
attribute withdita
orditamap
as value and ascope
attribute withlocal
as value. -
A reference to an image.
Example 1
Configure cross references to another DITA document.
Inside the path
element, create a reference
element with the attributes type
and target
.
The type
corresponds with the reference types that you have configured in the Fonto Editor.
The target
corresponds with the attribute in the XML that contains the reference target.
Your path
configuration should now look like this:
documentProcessing.xml
XML
<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd" xmlns:xlink="http://www.w3.org/1999/xlink">
<pathRewriting>
<reference typeName="document" targetAttribute="href">
</reference>
</pathRewriting>
</documentProcessing>
Configure the allowed DITA format and DITA scope attribute values.
Fonto Connectors has built in DITA support. To constraint a reference configuration on DITA scope and DITA format attributes, use the dita
and dita
elements in the matching
section.
To configure the DITA format and DITA scope attribute constraints, add the following part in the previously created reference
element:
XML
<matchingConstraints>
<ditaFormats>
<ditaFormat format="dita"/>
<ditaFormat format="ditamap"/>
</ditaFormats>
<ditaScope scope="local"/>
</matchingConstraints>
Your document
file should now look like this:
documentProcessing.xml
XML
<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd">
<pathRewriting>
<reference typeName="document" targetAttribute="href">
<matchingConstraints>
<ditaFormats>
<ditaFormat format="dita"/>
<ditaFormat format="ditamap"/>
</ditaFormats>
<ditaScope scope="local"/>
</matchingConstraints>
</reference>
</pathRewriting>
</documentProcessing>
Example 2
Configure image references.
Inside the path
element, create a reference
element with the attributes type
and target
.
You must create this reference
element below the reference
element that you configured in example 1. The reference
elements in the path
elements are a fallback list, the reference will be resolved via the first reference
element it matches.
Your path
configuration should now look like this:
XML
<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd" xmlns:xlink="http://www.w3.org/1999/xlink">
<pathRewriting>
<reference typeName="document" targetAttribute="href">
<!-- Configuration from example 1 -->
</reference>
<reference typeName="image" targetAttribute="href">
</reference>
</pathRewriting>
</documentProcessing>
Configure the allowed dita format attributes.
This configuration now selects all href
attributes, this is not the correct behavior, because web
references are now also marked as an image
reference. To restrict this reference configuration to only be matched on images, add the following DITA format attribute restriction in the just created reference
element:
XML
<matchingConstraints>
<ditaFormats>
<ditaFormat format="bmp"/>
<ditaFormat format="gif"/>
<ditaFormat format="ico"/>
<ditaFormat format="jpeg"/>
<ditaFormat format="jpg"/>
<ditaFormat format="png"/>
<ditaFormat format="svg"/>
</ditaFormats>
</matchingConstraints>
Your document
should now look like this:
documentProcessing.xml
XML
<documentProcessing xmlns="http://schemas.fontoxml.com/connectors/2.0/documentProcessing.xsd" xmlns:xlink="http://www.w3.org/1999/xlink">
<pathRewriting>
<reference typeName="document" targetAttribute="href">
<!-- Configuration from example 1 -->
</reference>
<reference typeName="image" targetAttribute="href">
<matchingConstraints>
<ditaFormats>
<ditaFormat format="bmp"/>
<ditaFormat format="gif"/>
<ditaFormat format="ico"/>
<ditaFormat format="jpeg"/>
<ditaFormat format="jpg"/>
<ditaFormat format="png"/>
<ditaFormat format="svg"/>
</ditaFormats>
</matchingConstraints>
</reference>
</pathRewriting>
</documentProcessing>
You should now have enough knowledge to work with the dita
and dita
restrictions. This allows you to complete the path rewriting configuration for DITA. For more generic documentation on path rewriting, please review the JATS example, which introduces the more common path rewriting options.