Difference between revisions of "ProsopToDiv.xsl"
Jump to navigation
Jump to search
Filologanoga (talk | contribs) (created) |
(No difference)
|
Latest revision as of 22:53, 20 February 2011
Summary
This is a stylesheet from the Croatiae auctores Latini TEI XML collection. For publishing under PhiloLogic, the TEI XML should conform to PhiloLogic specifications; this stylesheet reformats a prosopography list for easier referencing, searching and retrieving by PhiloLogic.
Required input
TEI XML file with a prosopography (see TEI P5 Guidelines 13.3 Biographical and Prosopographical Data).
Expected output
Valid TEI XML file conforming to PhiloLogic specification (with headings containing a standard Croatian variant of persons' names).
Known restrictions
Point (5) below not implemented yet.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:tei="http://www.tei-c.org/ns/1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!-- title: TEI prosopography to PhiloLogic divs -->
<!-- author: Neven Jovanović, Croatiae auctores Latini -->
<!-- description: (1) removes the general listPerson element -->
<!-- description: (2) wraps each person in a separate listPerson -->
<!-- description: (3a) add a pb so PhiloLogic can reference it -->
<!-- description: (3) adds div/head to each listPerson -->
<!-- description: (4) uses the persName[1] text for head text -->
<!-- description: [(5) hopefully links each listPerson with next/prev mechanism] -->
<!-- filename: prosop2div.xsl -->
<!-- modified: 2011-02-12 -->
<!-- required input: tei xml file with a prosopography (see TEI P5 Guidelines 13.3 Biographical and Prosopographical Data) -->
<!-- expected output: tei xml file easier to retrieve in PhiloLogic (with headings) -->
<!-- known restrictions: (5) left for later -->
<!-- prosop2div.xsl -->
<!-- copy all -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<!-- (1) delete listPerson -->
<xsl:template match="//tei:listPerson">
<xsl:apply-templates/>
</xsl:template>
<!-- (2) wrap up each person separately in a listPerson element -->
<xsl:template match="//tei:person">
<!-- (3a) add a pb so PhiloLogic can reference it -->
<xsl:element name="pb" namespace="http://www.tei-c.org/ns/1.0">
<xsl:attribute name="n">
<xsl:number/>
</xsl:attribute>
</xsl:element><xsl:text>
</xsl:text>
<xsl:element name="div" namespace="http://www.tei-c.org/ns/1.0">
<xsl:attribute name="type">
<!-- @type = persona -->
<xsl:text>persona</xsl:text>
<!-- add an @xml:id -->
</xsl:attribute>
<xsl:attribute name="xml:id">
<!-- ids begin with p -->
<xsl:text>p</xsl:text>
<!-- Here we generate an identifier
"if you call generate-id() more than once in one run with the same
node as an argument, the processor generates the same ID value each
time for that node." DuCharme, XML Quickly, p. 244-245. -->
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute><xsl:text>
</xsl:text>
<!-- (3) divs have heads, with (4) value of first persName text node -->
<xsl:element name="head" namespace="http://www.tei-c.org/ns/1.0">
<xsl:value-of select="tei:persName[1]/text()"/>
</xsl:element><xsl:text>
</xsl:text>
<xsl:element name="listPerson" namespace="http://www.tei-c.org/ns/1.0"><xsl:text>
</xsl:text>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:element><xsl:text>
</xsl:text>
</xsl:element>
</xsl:template>
</xsl:stylesheet>