diff options
| author | Felix Hanley <felix@userspace.com.au> | 2016-01-26 09:41:57 +0000 |
|---|---|---|
| committer | Felix Hanley <felix@userspace.com.au> | 2016-01-26 09:41:57 +0000 |
| commit | 60fae7f638286041afdae2138b16412786b8c1e0 (patch) | |
| tree | cfadb67b7f5f7e92edc2ef0c01cb11e697e0b9b6 | |
| parent | 2aeb55f94df5a0ce4d16b4919c69cd2f66b1e8ce (diff) | |
| download | lahu-dictionary-60fae7f638286041afdae2138b16412786b8c1e0.tar.gz lahu-dictionary-60fae7f638286041afdae2138b16412786b8c1e0.tar.bz2 | |
Fix sorting xslt
| -rw-r--r-- | xsl/sort.xsl | 71 |
1 files changed, 27 insertions, 44 deletions
diff --git a/xsl/sort.xsl b/xsl/sort.xsl index 6999400..ec498ea 100644 --- a/xsl/sort.xsl +++ b/xsl/sort.xsl @@ -1,47 +1,30 @@ <?xml version='1.0' encoding='UTF-8'?> -<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> - - <!-- - - $Revision$ - - This stylesheet sorts the entries of a TEI file using <xsl:sort>. - - The sorted dictionary can be further processed by - `group-homographs-sorted.xsl', which presupposes this - sorting. - - Limitations: - - * The internal DTD subset gets lost. - * All entry descendants of the <body> element become direct - children of the <body> element, eg. any <div0> children of - <body> get lost. - - --> - - <!-- - - Using the doctype-public and doctype-system attributes here is in vain, - since TEI needs an internal subset to include optional portions of the - TEI DTD. - - --> - <xsl:output method="xml" encoding="UTF-8"/> - - <xsl:template match="text/body"> - <body> - <xsl:apply-templates select=".//entry"> - <xsl:sort select="form/orth[1]"/> - </xsl:apply-templates> - </body> - </xsl:template> - - <!-- if no other template matches, - copy the encountered attributes and elements --> - <xsl:template match='@* | node()'> - <xsl:copy><xsl:apply-templates select='@* | node()'/></xsl:copy> - </xsl:template> +<xsl:stylesheet + version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns="http://www.tei-c.org/ns/1.0"> + + <xsl:output encoding="UTF-8" indent="yes" /> + <xsl:strip-space elements="*"/> + + <xsl:template match="text()[not(string-length(normalize-space()))]"/> + + <!-- + If xsltproc did version 2 + <xsl:template match=":text/:body"> + --> + <xsl:template match="*[local-name() = 'text']/*[local-name() = 'body']"> + <body> + <xsl:apply-templates select="*[local-name() = 'entry']"> + <xsl:sort select="*[local-name() = 'form']/*[local-name() = 'orth']"/> + </xsl:apply-templates> + </body> + </xsl:template> + + <xsl:template match='@*|node()'> + <xsl:copy> + <xsl:apply-templates select='@*|node()'/> + </xsl:copy> + </xsl:template> </xsl:stylesheet> - |
