Document filename

This topic shows an example on how to configure a default filename and a filename based on the first occurrence of a specified element.

For this example we will use the JATS article-title element to base the title on. If this element is not present in the document, we will use the title element. If none of the configured elements is present in the document, Untitled document is used as the title.

  1. Create a documentFilename element in the documentProcessing root element if it is not already present. You must also set a defaultFilename attribute on this element, specifying the filename to use if none of the specified title elements are found.

  2. Create an element named filenameElement with attribute name="article-title" inside the documentFilename element. This specifies the first article-title element as the document filename element. The inner text of this element will be used as the filename.

  3. Below the filenameElement you just created, create another element named filenameElement with attribute name="title". This specifies the first title element as the document filename element if no article-title element is found.

    The filenameElements are a list of fallbacks.

Your documentProcessing.xml 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">
	<!--Configure the extension for documents-->
	<documentFileExtension defaultExtension="xml"/>
	<!--Configure the title for documents-->
	<documentFilename defaultFilename="Untitled document">
		<filenameElement name="article-title"/>
		<filenameElement name="title"/>
	</documentFilename>
	<pathRewriting>
	</pathRewriting>
</documentProcessing>

Many more variations can be created to configure Fonto Connectors to suit your needs. You should now have enough knowledge to configure the document filenames.