JATS example

Prerequisite

Inside the root documentProcessing element in the documentProcessing.xml file, insert a pathRewriting 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

  1. An image in a graphic or inline-graphic element.
  2. A JATS ext-link-type element containing an ec reference.

Example 1

Configure a graphic or inline-graphic element.

Add the reference element.

Inside the pathRewriting element, create a reference element with the attributes typeName="image" and targetAttribute="xlink:href". The typeName corresponds with the reference types that you have configured in your FontoXML Editor instance. In this case, the graphic elements are configured as image reference type. The targetAttribute 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 pathRewriting configuration should now look like this:

documentProcessing.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 matchingElements only applies the reference resolving to the given elements.

To do so follow these steps:

  1. Add a matchingElements elements in the previously created reference element.
  2. Inside the matchingElements element add an element named element with attribute name="graphic".
  3. Alongside the just created element, create another element with a name="graphic" attribute.

Your pathRewriting configuration should now look like this:

documentProcessing.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 typeName="ext-link-ec" and targetAttribute="xlink:href".

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 matchingAttributes, follow these steps:

  1. Add a matchingAttributes element inside the just created reference element.
  2. Inside that matchingAttributes element add an element named attribute with name="ext-link-type" and value="ec" attributes. This covers the presence of an ext-link-type attribute with the value ec.

Your pathRewriting configuration should now look like this:

documentProcessing.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 matchingElements only applies the reference resolving to the given elements.

To do so, follow these steps:

  1. Add a matchingElements element inside the previously created reference element.
  2. Inside that matchingElements element add an element named elements with a name="ext-link" attribute.

Your pathRewriting configuration should now look like this:

documentProcessing.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 documentProcessing.xml configuration should now look like this:

documentProcessing.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.

Was this page helpful?