| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" |
|---|
| 3 |
xmlns:awmcgaz="http://www.unc.edu/awmc/gazetteer/schemata/ns/0.3" |
|---|
| 4 |
xmlns:adlgaz="http://www.alexandria.ucsb.edu/gazetteer/ContentStandard/version3.2/" |
|---|
| 5 |
xmlns:tei="http://www.tei-c.org/ns/1.0" |
|---|
| 6 |
xmlns:georss="http://www.georss.org/georss" |
|---|
| 7 |
xmlns:dc="http://purl.org/dc/elements/1.1/"> |
|---|
| 8 |
|
|---|
| 9 |
<xsl:template match="/"> |
|---|
| 10 |
<xsl:apply-templates /> |
|---|
| 11 |
</xsl:template> |
|---|
| 12 |
|
|---|
| 13 |
<xsl:template match="awmcgaz:geoEntity | adlgaz:featureName"> |
|---|
| 14 |
<xsl:copy> |
|---|
| 15 |
<xsl:copy-of select="@*"/> |
|---|
| 16 |
<xsl:apply-templates/> |
|---|
| 17 |
<dc:description><xsl:call-template name="calc_Description"/></dc:description> |
|---|
| 18 |
</xsl:copy> |
|---|
| 19 |
</xsl:template> |
|---|
| 20 |
|
|---|
| 21 |
<xsl:template match="*"> |
|---|
| 22 |
<xsl:copy> |
|---|
| 23 |
<xsl:copy-of select="@*"/> |
|---|
| 24 |
<xsl:apply-templates/> |
|---|
| 25 |
</xsl:copy> |
|---|
| 26 |
</xsl:template> |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
<xsl:template name="calc_Description"> |
|---|
| 30 |
<!-- calculates a description string for tests --> |
|---|
| 31 |
<xsl:variable name="calculatedDescription"><xsl:choose> |
|---|
| 32 |
<xsl:when test="local-name(.) = 'geoEntity'"><xsl:call-template name="calc_Description_geoEntity"/></xsl:when> |
|---|
| 33 |
<xsl:when test="local-name(.) = 'featureName'"><xsl:call-template name="calc_Description_name"/></xsl:when> |
|---|
| 34 |
<xsl:otherwise>Untrapped local-name() in named template "calc_Description" = "<xsl:value-of select="local-name(.)"/>"</xsl:otherwise> |
|---|
| 35 |
</xsl:choose></xsl:variable> |
|---|
| 36 |
<xsl:value-of select="normalize-space($calculatedDescription)"/></xsl:template> |
|---|
| 37 |
|
|---|
| 38 |
<xsl:template name="calc_Description_geoEntity"> |
|---|
| 39 |
<xsl:variable name="geoEntityType"><xsl:value-of select="normalize-space(./adlgaz:classificationSection[adlgaz:classificationScheme/adlgaz:schemeName='geoEntityType']/adlgaz:classificationTerm)"/></xsl:variable> |
|---|
| 40 |
<xsl:variable name="identification"> |
|---|
| 41 |
<xsl:call-template name="calc_Identification_geoEntity"> |
|---|
| 42 |
<xsl:with-param name="geoEntityType"><xsl:value-of select="$geoEntityType"/></xsl:with-param> |
|---|
| 43 |
</xsl:call-template> |
|---|
| 44 |
</xsl:variable> |
|---|
| 45 |
<xsl:variable name="periodization"> |
|---|
| 46 |
<xsl:call-template name="calc_Periodization_geoEntity"> |
|---|
| 47 |
<xsl:with-param name="geoEntityType"><xsl:value-of select="$geoEntityType"/></xsl:with-param> |
|---|
| 48 |
</xsl:call-template> |
|---|
| 49 |
</xsl:variable> |
|---|
| 50 |
<xsl:variable name="localization"> |
|---|
| 51 |
<xsl:call-template name="calc_Localization_geoEntity"> |
|---|
| 52 |
<xsl:with-param name="geoEntityType"><xsl:value-of select="$geoEntityType"/></xsl:with-param> |
|---|
| 53 |
</xsl:call-template> |
|---|
| 54 |
</xsl:variable> |
|---|
| 55 |
<xsl:variable name="nomination"> |
|---|
| 56 |
<xsl:call-template name="calc_Nomination_geoEntity"> |
|---|
| 57 |
<xsl:with-param name="geoEntityType"><xsl:value-of select="$geoEntityType"/></xsl:with-param> |
|---|
| 58 |
</xsl:call-template> |
|---|
| 59 |
</xsl:variable> |
|---|
| 60 |
<xsl:value-of select="$identification"/><xsl:value-of select="$periodization"/><xsl:value-of select="$localization"/>.<xsl:if test="string-length($nomination) > 0"><xsl:text> </xsl:text><xsl:value-of select="$nomination"/>.</xsl:if> |
|---|
| 61 |
</xsl:template> |
|---|
| 62 |
|
|---|
| 63 |
<xsl:template name="calc_Identification_geoEntity"> |
|---|
| 64 |
<xsl:param name="geoEntityType"/> |
|---|
| 65 |
<xsl:choose> |
|---|
| 66 |
<xsl:when test="$geoEntityType = 'unlocated'">An ancient geographic entity that cannot now be located with certainty</xsl:when> |
|---|
| 67 |
<xsl:when test="$geoEntityType = 'false'"><xsl:apply-templates select="//adlgaz:featureName[1]/awmcgaz:transliteration/text()"/> is a false geographic name<xsl:if test="//adlgaz:featureName[1]/adlgaz:classificationSection/awmcgaz:note"> (<xsl:apply-templates select="//adlgaz:featureName[1]/adlgaz:classificationSection/awmcgaz:note/text()"/>)</xsl:if></xsl:when> |
|---|
| 68 |
<xsl:otherwise>An ancient <xsl:value-of select="$geoEntityType"/></xsl:otherwise> |
|---|
| 69 |
</xsl:choose> |
|---|
| 70 |
</xsl:template> |
|---|
| 71 |
|
|---|
| 72 |
<xsl:template name="calc_Periodization_geoEntity"> |
|---|
| 73 |
<xsl:param name="geoEntityType"/> |
|---|
| 74 |
<xsl:variable name="periodCount"><xsl:value-of select="count(./adlgaz:timePeriod)"/></xsl:variable> |
|---|
| 75 |
<xsl:choose> |
|---|
| 76 |
<xsl:when test="$geoEntityType = 'false'"></xsl:when> |
|---|
| 77 |
<xsl:when test="$periodCount = 0">, attestation unkown</xsl:when> |
|---|
| 78 |
<xsl:when test="$periodCount = 1">, attested during the <xsl:value-of select="./adlgaz:timePeriod/adlgaz:timePeriodName"/> period</xsl:when> |
|---|
| 79 |
<xsl:otherwise>, attested during the <xsl:for-each select="./adlgaz:timePeriod"><xsl:value-of select="adlgaz:timePeriodName"/><xsl:if test="count(following-sibling::adlgaz:timePeriod) > 1">, </xsl:if><xsl:if test="count(following-sibling::adlgaz:timePeriod) = 1"> and </xsl:if></xsl:for-each> periods</xsl:otherwise> |
|---|
| 80 |
</xsl:choose> |
|---|
| 81 |
</xsl:template> |
|---|
| 82 |
|
|---|
| 83 |
<xsl:template name="calc_Localization_geoEntity"> |
|---|
| 84 |
<xsl:param name="geoEntityType"/> |
|---|
| 85 |
<xsl:if test="awmcgaz:modernLocation"><xsl:text> (</xsl:text><xsl:if test="$geoEntityType = 'unlocated'">approximate </xsl:if>modern location: <xsl:apply-templates select="awmcgaz:modernLocation/text()"/>)</xsl:if> |
|---|
| 86 |
</xsl:template> |
|---|
| 87 |
|
|---|
| 88 |
<xsl:template name="calc_Nomination_geoEntity"> |
|---|
| 89 |
<xsl:param name="geoEntityType"/> |
|---|
| 90 |
<xsl:if test="$geoEntityType != 'false'"> |
|---|
| 91 |
<xsl:variable name="nameCount"><xsl:value-of select="count(//adlgaz:featureName)"/></xsl:variable> |
|---|
| 92 |
<xsl:choose> |
|---|
| 93 |
<xsl:when test= "$nameCount = 0">Its ancient name is not known</xsl:when> |
|---|
| 94 |
<xsl:otherwise>It was known in antiquity by the name<xsl:if test="$nameCount > 1">s</xsl:if>: <xsl:for-each select="//adlgaz:featureName"><xsl:value-of select="awmcgaz:transliteration"/><xsl:if test="count(following-sibling::adlgaz:featureName) > 1">, </xsl:if><xsl:if test="count(following-sibling::adlgaz:featureName) = 1"> and </xsl:if></xsl:for-each></xsl:otherwise> |
|---|
| 95 |
</xsl:choose> |
|---|
| 96 |
</xsl:if> |
|---|
| 97 |
</xsl:template> |
|---|
| 98 |
|
|---|
| 99 |
<xsl:template name="calc_Description_name"> |
|---|
| 100 |
<xsl:variable name="geoNameType"><xsl:value-of select="normalize-space(./adlgaz:classificationSection[adlgaz:classificationScheme/adlgaz:schemeName='geoNameType']/adlgaz:classificationTerm)"/></xsl:variable> |
|---|
| 101 |
<xsl:variable name="geoEntityType"><xsl:value-of select="/descendant::adlgaz:classificationSection[adlgaz:classificationScheme/adlgaz:schemeName='geoEntityType']/adlgaz:classificationTerm"/></xsl:variable> |
|---|
| 102 |
<xsl:variable name="identification"> |
|---|
| 103 |
<xsl:call-template name="calc_Identification_geoName"> |
|---|
| 104 |
<xsl:with-param name="geoEntityType"><xsl:value-of select="$geoEntityType"/></xsl:with-param> |
|---|
| 105 |
<xsl:with-param name="geoNameType"><xsl:value-of select="$geoNameType"/></xsl:with-param> |
|---|
| 106 |
</xsl:call-template> |
|---|
| 107 |
</xsl:variable> |
|---|
| 108 |
<xsl:variable name="periodization"> |
|---|
| 109 |
<xsl:call-template name="calc_Periodization_geoName"> |
|---|
| 110 |
<xsl:with-param name="geoNameType"><xsl:value-of select="$geoNameType"/></xsl:with-param> |
|---|
| 111 |
</xsl:call-template> |
|---|
| 112 |
</xsl:variable> |
|---|
| 113 |
<xsl:value-of select="$identification"/><xsl:value-of select="$periodization"/>. |
|---|
| 114 |
</xsl:template> |
|---|
| 115 |
|
|---|
| 116 |
<xsl:template name="calc_Identification_geoName"> |
|---|
| 117 |
<xsl:param name="geoEntityType"/> |
|---|
| 118 |
<xsl:param name="geoNameType"/> |
|---|
| 119 |
<xsl:choose> |
|---|
| 120 |
<xsl:when test="adlgaz:name">(<xsl:apply-templates select="adlgaz:name/text()"/>): </xsl:when> |
|---|
| 121 |
</xsl:choose> |
|---|
| 122 |
<xsl:choose> |
|---|
| 123 |
<xsl:when test="$geoEntityType = 'false'">A false name; i.e., one introduced in error by an ancient source or modern commentator</xsl:when> |
|---|
| 124 |
<xsl:when test="$geoEntityType = 'unlocated'">An ancient name for a geographic entity that cannot now be located with certainty</xsl:when> |
|---|
| 125 |
<xsl:otherwise>An ancient <xsl:value-of select="$geoNameType"/> name for a <xsl:value-of select="normalize-space(/descendant::adlgaz:classificationSection[adlgaz:classificationScheme/adlgaz:schemeName='geoEntityType']/adlgaz:classificationTerm)"/></xsl:otherwise> |
|---|
| 126 |
</xsl:choose> |
|---|
| 127 |
</xsl:template> |
|---|
| 128 |
|
|---|
| 129 |
<xsl:template name="calc_Periodization_geoName"> |
|---|
| 130 |
<xsl:param name="geoNameType"/> |
|---|
| 131 |
<xsl:variable name="periodCount"><xsl:value-of select="count(adlgaz:timePeriod)"/></xsl:variable> |
|---|
| 132 |
<xsl:choose> |
|---|
| 133 |
<xsl:when test="$periodCount = 1">, attested during the <xsl:value-of select="./adlgaz:timePeriod/adlgaz:timePeriodName"/> period</xsl:when> |
|---|
| 134 |
<xsl:when test="$periodCount > 1">, attested during the <xsl:for-each select="./adlgaz:timePeriod"><xsl:value-of select="adlgaz:timePeriodName"/><xsl:if test="count(following-sibling::adlgaz:timePeriod) > 1">, </xsl:if><xsl:if test="count(following-sibling::adlgaz:timePeriod) = 1"> and </xsl:if></xsl:for-each> periods</xsl:when> |
|---|
| 135 |
<xsl:otherwise> |
|---|
| 136 |
<xsl:variable name="entityPeriodCount"><xsl:value-of select="count(/awmcgaz:geoEntity/adlgaz:timePeriod)"/></xsl:variable> |
|---|
| 137 |
<xsl:choose> |
|---|
| 138 |
<xsl:when test="$entityPeriodCount > 0">, attested during the <xsl:for-each select="/awmcgaz:geoEntity/adlgaz:timePeriod"><xsl:value-of select="adlgaz:timePeriodName"/><xsl:if test="count(following-sibling::adlgaz:timePeriod) > 1">, </xsl:if><xsl:if test="count(following-sibling::adlgaz:timePeriod) = 1"> and </xsl:if></xsl:for-each> period<xsl:if test="$entityPeriodCount > 1">s</xsl:if></xsl:when> |
|---|
| 139 |
</xsl:choose></xsl:otherwise> |
|---|
| 140 |
</xsl:choose> |
|---|
| 141 |
</xsl:template> |
|---|
| 142 |
</xsl:stylesheet> |
|---|