diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/stex/xsl/omdocpost.xsl')
-rw-r--r-- | Master/texmf-dist/source/latex/stex/xsl/omdocpost.xsl | 457 |
1 files changed, 0 insertions, 457 deletions
diff --git a/Master/texmf-dist/source/latex/stex/xsl/omdocpost.xsl b/Master/texmf-dist/source/latex/stex/xsl/omdocpost.xsl deleted file mode 100644 index f3198fc1532..00000000000 --- a/Master/texmf-dist/source/latex/stex/xsl/omdocpost.xsl +++ /dev/null @@ -1,457 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- this style sheet transforms the tex.xml file to OMDoc --> -<xsl:stylesheet version="1.0" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns="http://omdoc.org/ns" - xmlns:omdoc="http://omdoc.org/ns" - xmlns:mcd="http://www.w3.org/ns/mathml-cd" - xmlns:ltx="http://dlmf.nist.gov/LaTeXML" - xmlns:stex="http://kwarc.info/ns/sTeX" - xmlns:m="http://www.w3.org/1998/Math/MathML" - xmlns:om="http://www.openmath.org/OpenMath" - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:str="http://exslt.org/strings" - extension-element-prefixes="str" - exclude-result-prefixes="xsl omdoc ltx m om dc"> - -<xsl:output method="xml" indent="yes" cdata-section-elements="data"/> -<xsl:strip-space elements="*"/> - -<!-- these parameters set the paths to the special latexml cds. The default is made so that it works for GenCS --> -<xsl:param name="latexmlcds" select="'../../../slides/extcds/stex'"/> -<xsl:param name="omcds" select="'../../../slides/extcds/omstd'"/> - -<xsl:template match="/"> - <xsl:comment>This OMDoc document is generated from an sTeX-encoded one via LaTeXML, you may want to reconsider editing it.</xsl:comment> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="omdoc:omdoc"> - <xsl:copy> - <xsl:copy-of select="@*"/> - <xsl:apply-templates/> - <xsl:comment>The data elements</xsl:comment> - <xsl:apply-templates mode="extract-data"/> - </xsl:copy> -</xsl:template> - -<xsl:template match="*"> - <xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy> -</xsl:template> - -<xsl:template match="ltx:ERROR"/> -<xsl:template match="*|text()" mode="extract-data"> - <xsl:apply-templates mode="extract-data"/> -</xsl:template> - -<xsl:template match="ltx:Math"> - <xsl:apply-templates select="om:OMOBJ"/> -</xsl:template> - -<!-- we directly access the content of titles --> -<xsl:template match="ltx:title"/> -<xsl:template match="ltx:chapter|ltx:part|ltx:section|ltx:subsection|ltx:subsubsection|ltx:paragraph"> - <omgroup layout="sectioning"> - <xsl:copy-of select="@*"/> - <metadata> - <dc:title><xsl:apply-templates select="ltx:title/*|ltx:title/text()"/></dc:title> - </metadata> - <xsl:apply-templates/> - </omgroup> -</xsl:template> - -<xsl:template match="ltx:p"> - <p><xsl:copy-of select="@*"/><xsl:apply-templates/></p> -</xsl:template> - -<xsl:template match="ltx:para"> - <omtext><xsl:copy-of select="@*"/><CMP><xsl:apply-templates/></CMP></omtext> -</xsl:template> - -<xsl:template match="ltx:text"> - <phrase> - <xsl:copy-of select="@*"/> - <xsl:if test="@font"> - <xsl:attribute name="class"><xsl:value-of select="@font"/></xsl:attribute> - </xsl:if> - <xsl:apply-templates/> - </phrase> -</xsl:template> - - -<xsl:template match="ltx:graphics|ltx:verbatim"> - <omlet action="display" data="#{generate-id()}" show="embed" style="{translate(@options,'=',':')}"> - <xsl:copy-of select="@*"/> - </omlet> -</xsl:template> - -<xsl:template match="omdoc:tikz"> - <omlet action="display" data="#{generate-id()}" show="embed" style="{translate(@options,'=',':')}"> - <xsl:copy-of select="@*"/> - </omlet> -</xsl:template> - -<!-- for citations we just extract the bibrefs at the moment. --> -<xsl:template match="ltx:cite"><xsl:apply-templates select="ltx:bibref"/></xsl:template> -<xsl:template match="ltx:bibref"> - <citation><xsl:copy-of select="@bibrefs"/></citation> -</xsl:template> - -<!-- we ignore LaTeXML breaks --> -<xsl:template match="ltx:break"/> - -<xsl:template match="ltx:figure[ltx:graphics]"> - <omlet action="display" data="#{generate-id(ltx:graphics)}" show="embed" class="float-figure-{@placement}"> - <xsl:if test="@label"> - <xsl:attribute name="xml:id"><xsl:value-of select="@label"/></xsl:attribute> - </xsl:if> - <xsl:if test="ltx:graphics/@options"> - <xsl:attribute name="style"><xsl:value-of select="translate(ltx:graphics/@options,'=',':')"/></xsl:attribute> - </xsl:if> - <xsl:if test="ltx:caption/*|ltx:caption/text()"> - <metadata><dc:title><xsl:apply-templates select="ltx:caption/*|ltx:caption/text()"/></dc:title></metadata> - </xsl:if> - </omlet> -</xsl:template> - -<xsl:template match="ltx:graphics" mode="extract-data"> - <private> - <xsl:attribute name="xml:id"><xsl:value-of select="generate-id()"/></xsl:attribute> - <xsl:variable name="sources" select="str:tokenize(@sources,',')"/> - <xsl:variable name="graphic" select="@graphic"/> - <xsl:for-each select="$sources"> - <xsl:variable name="current" select="."/> - <xsl:variable name="type"> - <xsl:choose> - <xsl:when test="$current='jpg'"> - <xsl:value-of select="'image/jpeg'"/> - </xsl:when> - <xsl:when test="$current='jpeg'"> - <xsl:value-of select="'image/jpeg'"/> - </xsl:when> - <xsl:when test="$current='png'"> - <xsl:value-of select="'image/png'"/> - </xsl:when> - <xsl:when test="$current='gif'"> - <xsl:value-of select="'image/gif'"/> - </xsl:when> - <xsl:when test="$current='eps'"> - <xsl:value-of select="'application/postscript'"/> - </xsl:when> - <xsl:when test="$current='ps'"> - <xsl:value-of select="'application/postscript'"/> - </xsl:when> - <xsl:when test="$current='ai'"> - <xsl:value-of select="'application/postscript'"/> - </xsl:when> - <xsl:when test="$current='pdf'"> - <xsl:value-of select="'application/pdf'"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="$current"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - <data format="{$type}" href="{$graphic}.{.}"/> - </xsl:for-each> - </private> -</xsl:template> -<xsl:template match="ltx:verbatim" mode="extract-data"> - <private> - <xsl:attribute name="xml:id"><xsl:value-of select="generate-id()"/></xsl:attribute> - <data format="text"><xsl:value-of select="text()"/></data> - </private> -</xsl:template> - -<xsl:template match="omdoc:tikz|ltx:tikz" mode="extract-data"> - <private> - <xsl:attribute name="xml:id"><xsl:value-of select="generate-id()"/></xsl:attribute> - <data format="tikz"><xsl:value-of select="."/></data> - </private> -</xsl:template> - -<!-- for LaTeXML tables --> -<xsl:template match="ltx:tabular"> - <table> - <xsl:copy-of select="@*"/> - <xsl:apply-templates/> - </table> -</xsl:template> - -<xsl:template match="ltx:tr"> - <tr> - <xsl:copy-of select="@*"/> - <xsl:apply-templates/> - </tr> -</xsl:template> - -<xsl:template match="ltx:td"> - <td> - <xsl:copy-of select="@*"/> - <xsl:apply-templates/> - </td> -</xsl:template> - -<xsl:template match="ltx:thead|ltx:tbody"><xsl:apply-templates/></xsl:template> - -<!-- for LaTeXML references from \url --> -<xsl:template match="ltx:ref[@class='url']"> - <link href="{@href}" class="url"> - <xsl:value-of select="ltx:text"/> - </link> -</xsl:template> - -<xsl:template match="ltx:ref[@labelref]"> - <ref type="cite" xref="{@labelref}"/> -</xsl:template> - -<!-- LaTeXML listings --> -<xsl:template match="ltx:text[@class='listing']"> - <omdoc:phrase type='progsnippet'><xsl:copy-of select="@*"/><xsl:apply-templates/></omdoc:phrase> -</xsl:template> - -<xsl:template match="ltx:listingblock"> - <omlet action='display' show='embed' style='display:block'> - <xsl:copy-of select="@*"/> - <code> - <data format='listingblock'><xsl:apply-templates mode="listing"/></data> - </code> - </omlet> -</xsl:template> - -<xsl:template match="ltx:tabular" mode="listing"> - <table class="listing"><xsl:apply-templates mode="listing"/></table> -</xsl:template> - -<xsl:template match="ltx:tr" mode="listing"> - <tr><xsl:apply-templates mode="listing"/></tr> -</xsl:template> - -<xsl:template match="ltx:td" mode="listing"> - <td><xsl:apply-templates mode="listing"/></td> -</xsl:template> - -<xsl:template match="ltx:text[not(@*)]" mode="listing"> - <xsl:apply-templates mode="listing"/> -</xsl:template> - -<xsl:template match="ltx:text[@font='bold']" mode="listing"> - <keyword><xsl:apply-templates mode="listing"/></keyword> -</xsl:template> - -<xsl:template match="ltx:text[@color]" mode="listing"> - <phrase> - <xsl:attribute name='type'><xsl:text>lstemph</xsl:text></xsl:attribute> - <xsl:attribute name='style'><xsl:text>color:</xsl:text><xsl:value-of select="@color"/></xsl:attribute> - <xsl:apply-templates mode="listing"/> - </phrase> -</xsl:template> - -<xsl:template match="ltx:text[@class]" mode="listing"> - <xsl:apply-templates mode="listing"/> -</xsl:template> - - -<xsl:template match="ltx:*" mode="listing"> - <xsl:message>cannot deal with element <xsl:value-of select="local-name()"/> yet!</xsl:message> -</xsl:template> - - -<xsl:template match="ltx:equation"> - <om:OMOBJ style="display:block"> - <xsl:apply-templates select="ltx:Math/om:OMOBJ/*"/> - </om:OMOBJ> -</xsl:template> - -<!-- equationgroups come from eqnarray and eqnarray*, they really need OMDoc-level parallel markup --> -<xsl:template match="ltx:equationgroup"> - <xsl:apply-templates/> -</xsl:template> - -<xsl:template match="ltx:equationgroup/ltx:equation"> - <om:OMOBJ style="display:block"> - <xsl:apply-templates select="ltx:MathFork/ltx:Math/om:OMOBJ/*"/> - </om:OMOBJ> -</xsl:template> - - -<!-- for notations --> -<xsl:template match="omdoc:rendering"> - <xsl:apply-templates select="." mode="rendering"/> -</xsl:template> -<xsl:template match="ltx:Math" mode="rendering"> - <xsl:apply-templates select="m:math/*" mode="rendering"/> -</xsl:template> - -<!-- copy where not specified otherwise --> -<xsl:template match="*" mode="rendering"> - <xsl:copy><xsl:copy-of select="@*[not(name()='argprec')]"/><xsl:apply-templates mode="rendering"/></xsl:copy> -</xsl:template> - -<xsl:template match="ltx:text" mode="rendering"> - <text><xsl:value-of select="text()"/></text> -</xsl:template> - -<!-- Template to recover the appropriate argument precedence" --> -<xsl:template name="argument-precedence"> - <xsl:param name="count" select="1"/> - <xsl:param name="precattr" select="1"/> - <xsl:choose> - <xsl:when test="$count > 1"> - <xsl:call-template name="argument-precedence"> - <xsl:with-param name="count" select="$count - 1"/> - <xsl:with-param name="precattr" select="substring-after($precattr,' ')"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="substring-before($precattr,' ')"/> - </xsl:otherwise> - </xsl:choose> -</xsl:template> - -<!-- we have to treat the m:mi that come from an - #i argument invocation differently --> -<xsl:template match="m:mi[starts-with(.,'arg:')]|m:mo[starts-with(.,'arg:')]" mode="rendering"> - <xsl:variable name="precedence"> - <xsl:call-template name="argument-precedence"> - <xsl:with-param name="count" select="substring-after(.,'arg:')"/> - <xsl:with-param name="precattr" select="ancestor::omdoc:rendering[1]/@argprec"/> - </xsl:call-template> - </xsl:variable> - <render name="arg{substring-after(.,'arg:')}"> - <xsl:choose> - <xsl:when test="string($precedence)"> - <xsl:attribute name="precedence"><xsl:value-of select="$precedence"/></xsl:attribute> - </xsl:when> - <xsl:when test="string(ancestor::omdoc:rendering[1]/@precedence)"> - <xsl:attribute name="precedence"><xsl:value-of select="ancestor::omdoc:rendering[1]/@precedence"/></xsl:attribute> - </xsl:when> - <xsl:otherwise/> - </xsl:choose> - </render> -</xsl:template> - - -<!-- make an mrow around the generated things. --> -<xsl:template match="omdoc:style[@format='pmml']"> - <xsl:copy> - <xsl:copy-of select="@*"/> - <element name="mrow" ns="http://www.w3.org/1998/Math/MathML"> - <xsl:apply-templates/> - </element> - </xsl:copy> -</xsl:template> - - -<xsl:template match="omdoc:separator/ltx:Math"> - <xsl:apply-templates select="m:math/*" mode="elementize"/> -</xsl:template> - -<xsl:template match="omdoc:map/ltx:Math"> - <xsl:apply-templates select="m:math/*" mode="elementize"/> -</xsl:template> - - -<xsl:template match="text()" mode="elementize"> - <text><xsl:value-of select="."/></text> -</xsl:template> - -<xsl:template match="ltx:text" mode="elementize"> - <element name="mtext" ns="http://www.w3.org/1998/Math/MathML"> - <xsl:value-of select="."/> - </element> -</xsl:template> - -<xsl:template match="m:*" mode="elementize"> - <element name="{local-name()}" ns="{namespace-uri()}"> - <xsl:for-each select="@*"> - <attribute name="{local-name()}" select="'{.}'"/> - </xsl:for-each> - <xsl:apply-templates mode="elementize"/> - </element> -</xsl:template> - -<!-- get rid of the list OMAs LaTeXML uses --> -<xsl:template match="om:OMA[om:OMS[position()=1 and @name='list' and @cd='latexml']]"> - <xsl:apply-templates select="*[position() > 1]"/> -</xsl:template> - -<!-- special treatment for latexml symbols --> -<!-- we have a set of special CDs that correspond to the ones latexml postulates --> -<!-- they need to be imported whereever necessary --> -<xsl:template match="omdoc:theory"> - <theory> - <xsl:copy-of select="@*"/> - <xsl:if test="//om:OMS[@cd='latexml' and @name='multirelation']"> - <imports from="{$latexmlcds}/multirel.omdoc#multirel"/> - </xsl:if> - <xsl:if test="//om:OMS[@cd='latexml' and - (@name='times' or - @name='divide' or - @name='plus' or - @name='minus')]"> - <imports from="{$omcds}/arith1.omdoc#arith1"/> - </xsl:if> - <xsl:if test="//om:OMS[@cd='latexml' and - (@name='greater-than' or - @name='less-than' or - @name='not-equals' or - @name='greater-than-or-equals' or - @name='less-than-or-equals')]"> - <imports from="{$omcds}/relation1.omdoc#relation1"/> - </xsl:if> - <xsl:apply-templates/> - </theory> -</xsl:template> - -<!-- and we need to convert the symbols --> -<xsl:template match="om:OMS[@cd='latexml' and @name='multirelation']"> - <om:OMS cd="multirel" name="multirelation"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='multirelation']"/> - - -<xsl:template match="om:OMS[@cd='latexml' and @name='plus']"> - <om:OMS cd="arith1" name="plus"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='minus']"> - <om:OMS cd="arith1" name="minus"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='times']"> - <om:OMS cd="arith1" name="times"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='divide']"> - <om:OMS cd="arith1" name="divide"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='greater-than']"> - <om:OMS cd="relation1" name="gt"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='greater-than-or-equals']"> - <om:OMS cd="relation1" name="gt"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='less-than']"> - <om:OMS cd="relation1" name="lt"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='less-than-or-equals']"> - <om:OMS cd="relation1" name="lt"/> -</xsl:template> - -<xsl:template match="om:OMS[@cd='latexml' and @name='not-equals']"> - <om:OMS cd="relation1" name="neq"/> -</xsl:template> - -<!-- get rid of the sectioning commands --> -<xsl:template match="omdoc:chapter|omdoc:section|omdoc:subsection|omdoc:subsubsection|omdoc:paragraph|omdoc:subparagraph"> - <omgroup class="{local-name()}"> - <xsl:copy-of select="@*|*"/> - </omgroup> -</xsl:template> -</xsl:stylesheet> |