Header and Footer Fragments
Another common use case for fragments is for common headers/footers. For more information on headers/footers please refer to the Structure Guide. For example, the following code creates a footer, and includes it in this document:
document.xml
<document xmlns="http://resources.qdexapps.com/schema/v1/QDocument.xsd" name="myDocument"> <!-- Meta Data --> <metadata> <title>Fragments</title> <creator>Peter Martin</creator> <abstract>An example document that illustrates how to include fragments in a document.</abstract> </metadata> <footer> <include src="fragment2.xml"/> </footer>
fragment2.xml
<fragment xmlns="http://resources.qdexapps.com/schema/v1/QDocument.xsd"> <p> <style> <foreground color="red"/> <horizontalAlignment>center</horizontalAlignment> <textAlignment>center</textAlignment> </style> This is my footer. It lives in a fragment </p> </fragment>
Which looks like the following when the document is rendered