J AT S example
Inside the root document
element in the documentProcessing.xml 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
-
An image in a
graphic
orinline-graphic
element. -
A JATS
ext-link-type
element containing anec
reference.
Example 1
Configure a graphic
or inline-graphic
element.
Add the reference
element.
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 Fonto Editor. In this case, the graphic
elements are configured as image
reference type. The target
corresponds with the attribute in the XML that contains the reference target. Note that in this case the xlink
namespace prefix is used. This is required for elements that have a namespace prefix.
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="image" targetAttribute="xlink:href">
</reference>
</pathRewriting>
</documentProcessing>
Configure the matching elements.
We only want to resolve hrefs
in graphic
and inline-graphic
elements. Configuring the matching
only applies the reference resolving to the given elements.
To do so follow these steps:
-
Add a
matching
elements in the previously createdElements reference
element. -
Inside the
matching
element add an element namedElements element
with attributename="graphic"
. -
Alongside the just created
element
, create anotherelement
with aname="graphic"
attribute.
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="image" targetAttribute="xlink:href">
<matchingElements>
<element name="graphic"/>
<element name="inline-graphic"/>
</matchingElements>
</reference>
</pathRewriting>
</documentProcessing>
Example 2
Configure a JATS ext-link-type
element containing an ec
reference.
As a sibling to the reference
element you have just created in step 1, create another reference
element.
Create a reference
element with the attributes type
and target
.
Configure matching attributes.
We only want to resolve ext-link
elements with an ext-link-type
attribute that has the value ec
. To configure the matching
, follow these steps:
-
Add a
matching
element inside the just createdAttributes reference
element. -
Inside that
matching
element add an element namedAttributes attribute
withname="ext-link-type"
andvalue="ec"
attributes. This covers the presence of anext-link-type
attribute with the valueec
.
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="ext-link-ec" targetAttribute="xlink:href">
<matchingAttributes>
<attribute name="ext-link-type" value="ec"/>
</matchingAttributes>
</reference>
</pathRewriting>
</documentProcessing>
Configure matching elements.
We only want to apply this reference resolve strategy to hrefs
in ext-link
elements. Configuring the matching
only applies the reference resolving to the given elements.
To do so, follow these steps:
-
Add a
matching
element inside the previously createdElements reference
element. -
Inside that
matching
element add an element namedElements elements
with aname="ext-link"
attribute.
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="ext-link-ec" targetAttribute="xlink:href">
<matchingAttributes>
<attribute name="ext-link-type" value="ec"/>
</matchingAttributes>
<matchingElements>
<element name="ext-link"/>
</matchingElements>
</reference>
</pathRewriting>
</documentProcessing>
Your document
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="ext-link-ec" targetAttribute="xlink:href">
<matchingAttributes>
<attribute name="ext-link-type" value="ec"/>
</matchingAttributes>
<matchingElements>
<element name="ext-link"/>
</matchingElements>
</reference>
<reference typeName="image" targetAttribute="xlink:href">
<matchingElements>
<element name="graphic"/>
<element name="inline-graphic"/>
</matchingElements>
</reference>
</pathRewriting>
</documentProcessing>
You should now have enough knowledge to work with the path rewriting configuration. This allows you to complete the path rewriting configuration for any schema. For more DITA specific documentation, please review the DITA example.