diff options
Diffstat (limited to 'Master/Tools/tpmfromcat.xsl')
-rw-r--r-- | Master/Tools/tpmfromcat.xsl | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Master/Tools/tpmfromcat.xsl b/Master/Tools/tpmfromcat.xsl new file mode 100644 index 00000000000..4276721c9c2 --- /dev/null +++ b/Master/Tools/tpmfromcat.xsl @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:TPM="http://texlive.dante.de/" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + exclude-result-prefixes="rdf TPM" + version="1.0"> + +<xsl:output + method="xml" + indent="yes" + doctype-system="../../Tools/tpm.dtd" + /> + +<xsl:param name="sarovar"/> +<xsl:param name="authors"/> + +<xsl:template match="@*|processing-instruction()|comment()|text()" > + <xsl:copy/> +</xsl:template> + +<xsl:template match="*" > + <xsl:copy> + <xsl:apply-templates + select="*|@*|processing-instruction()|comment()|text()" /> + </xsl:copy> +</xsl:template> + +<xsl:template match="TPM:Description"> + <xsl:variable name="S"> + <xsl:value-of select="document($sarovar)/entry/description"/> + </xsl:variable> + <TPM:Description> + <xsl:choose> + <xsl:when test="$S=''"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$S"/> + [description copied from TeX Catalogue] + </xsl:otherwise> + </xsl:choose> + </TPM:Description> +</xsl:template> + +<xsl:template match="TPM:Title"> + <xsl:variable name="S"> + <xsl:value-of select="document($sarovar)/entry/caption"/> + </xsl:variable> + <TPM:Title> + <xsl:choose> + <xsl:when test="$S=''"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$S"/> + </xsl:otherwise> + </xsl:choose> + </TPM:Title> +</xsl:template> + +<xsl:template match="TPM:Author"> + <xsl:variable name="A"> + <xsl:value-of select="document($sarovar)/entry/authorref/@id"/> + </xsl:variable> + <xsl:variable name="S"> + <xsl:value-of select="document($authors)/authors/author[@id=$A]"/> + </xsl:variable> + <TPM:Author> + <xsl:choose> + <xsl:when test="$S=''"> + <xsl:apply-templates/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="$S"/> + </xsl:otherwise> + </xsl:choose> + </TPM:Author> +</xsl:template> + +</xsl:stylesheet> |