--------------------------------------- Reading and Writing DLTN XSL Transforms --------------------------------------- This section is designed to help make reading and modifying our transforms as easy as possible for new people. Header and Globals ================== Stylesheet Attributes --------------------- Our stylesheet attributes should look similar across the entire repository. In addition to declaring any needed namespaces, we define a default namespace that is equal to the namespace of the output document (usually MODS). This makes it so our final documents don't have the mods namespace repeated throughout. .. code-block:: xslt :emphasize-lines: 7 We also define an `xpath-default-namespace` so that our selectors are less verbose. This is normally equal to namespace of your primary template match. .. code-block:: xslt :emphasize-lines: 9 Finally, we need to exclude all outgoing prefixes so they aren't in our output document. .. code-block:: xslt :emphasize-lines: 8 Output settings --------------- Although not necessarily used by the Repox XSL processor, we add output settings for people who may test XML generation from the command line. Copy and pasting this as is is fine. .. code-block:: xslt Includes and imports -------------------- In order to be DRY, often times you will want to include or import another stylesheet. Do that at the top of your document .. code-block:: xslt Text normalization ------------------ In order to be DRY, add a normalize space template at the top of your document to accompany the main identity transform. .. code-block:: xslt Identity transform ================== In order to keep our transforms as simple as possible, we require that all new transforms start with an identity transform. This is our primary template and tells the processor to copy all attributes and all nodes recursively. This template is then accompanied by other transforms that give more explicit instructions. .. code-block:: xslt Primary template match ====================== After your identity transform, add a primary template that tells the processor where your metadata records are. .. code-block:: xslt Inside our main template match we will start serializing our final document. .. code-block:: xslt Finally, we will call other templates throughout our main template. .. code-block:: xslt :emphasize-lines: 8,13,32,33 All rights reserved. The accompanying digital object and its associated documentation are provided for online research and access purposes. Permission to use, copy, modify, distribute and present this digital object and the accompanying documentation, without fee, and without written agreement, is hereby granted for educational, non-commercial purposes only. The Rhodes College Archives reserves the right to decide what constitutes educational and commercial use; commercial users may be charged a nominal fee to be determined by current, commercial rates for use of special materials. In all instances of use, acknowledgement must begiven to Rhodes College Archives and Special Collection, Memphis, TN. For information regarding permission to use this image, please email the Archives at archives@rhodes.edu or call 901-843-3334. Sub templates ============= From our main template, we will apply other templates throughout our stylesheet. These templates should match on the corresponding selector. .. code-block:: xslt <xsl:apply-templates/>