-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-langues-map-generator.xsl
More file actions
27 lines (24 loc) · 1.41 KB
/
code-langues-map-generator.xsl
File metadata and controls
27 lines (24 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.tei-c.org/ns/1.0" xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl" />
<xsl:template match="/">
<!-- Generates an xslt stylesheet from an xml data file -->
<axsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.tei-c.org/ns/1.0">
<axsl:strip-space elements="*" />
<axsl:output method="xml" indent="yes" />
<!-- Create an xslt "hashmap" (key value pair) with the data of the xml file-->
<axsl:template name="codeLangue">
<axsl:param name="code" />
<axsl:variable name="var">
<xsl:for-each select="//languages/language">
<xsl:if test="./ISO_639_1 != ''">
<xsl:value-of select="concat(';', ./ISO_639_2, '=', ./ISO_639_1)"></xsl:value-of>
</xsl:if>
</xsl:for-each>
</axsl:variable>
<axsl:value-of select="substring-before(substring-after($var, concat(';', $code, '=')), ';')" />
</axsl:template>
</axsl:stylesheet>
</xsl:template>
</xsl:stylesheet>