LaTeXML

 view release on metacpan or  search on metacpan

lib/LaTeXML/resources/XSLT/LaTeXML-common.xsl  view on Meta::CPAN

<?xml version="1.0" encoding="utf-8"?>
<!--
/=====================================================================\
|  Common utility functions for stylesheet; for inclusion             |
|=====================================================================|
| Part of LaTeXML:                                                    |
|  Public domain software, produced as part of work done by the       |
|  United States Government & not subject to copyright in the US.     |
|=====================================================================|
| Bruce Miller <bruce.miller@nist.gov>                        #_#     |
| http://dlmf.nist.gov/LaTeXML/                              (o o)    |
\=========================================================ooo==U==ooo=/
-->
<xsl:stylesheet
    version     = "1.0"
    xmlns:xsl   = "http://www.w3.org/1999/XSL/Transform"
    xmlns:ltx   = "http://dlmf.nist.gov/LaTeXML"
    xmlns:exsl  = "http://exslt.org/common"
    xmlns:string= "http://exslt.org/strings"
    xmlns:date  = "http://exslt.org/dates-and-times"
    xmlns:func  = "http://exslt.org/functions"
    xmlns:f     = "http://dlmf.nist.gov/LaTeXML/functions"
    xmlns:xhtml = "http://www.w3.org/1999/xhtml"
    extension-element-prefixes="func f exsl string date"
    exclude-result-prefixes = "ltx f func string">

  <!-- ALL CAPS parameters are intended to be passed in;
       lower case ones are (mostly) intended for internal use-->

  <!-- ======================================================================
       Parameters -->
  <!-- The version of LaTeXML being used; for generator messages. -->
  <xsl:param name="LATEXML_VERSION"></xsl:param>

  <!-- A string indicating the date and time of document generation or processing. -->
  <xsl:param name="TIMESTAMP"></xsl:param>

  <!-- What version of RDFa to generate. [Set to "1.0" for broken behaviour] -->
  <xsl:param name="RDFA_VERSION"></xsl:param>

  <!-- Whether to use Namespaces in the generated xml/xhtml/...-->
  <xsl:param name="USE_NAMESPACES">true</xsl:param>

  <!-- Whether to use HTML5 constructs in the generated html. -->
  <xsl:param name="USE_HTML5"></xsl:param>

  <!-- The XHTML namespace -->
  <xsl:param name="XHTML_NAMESPACE">http://www.w3.org/1999/xhtml</xsl:param>

  <!-- Whether to use xml:id instead of plain ole id;
       Not sure if we ever should; probably depends on embedded schema, as well? -->
  <xsl:param name="USE_XMLID"></xsl:param>

  <!-- The namespace to use on html elements (typically XHTML_NAMESPACE or none) -->
  <xsl:param name="html_ns">
    <xsl:value-of select="f:if($USE_NAMESPACES,$XHTML_NAMESPACE,'')"/>
  </xsl:param>

  <!-- Whether to convert foreign-namespaced attributes into html-style data-* attributes -->
  <xsl:param name="USE_DATA_ATTRIBUTES">
    <xsl:value-of select="$USE_HTML5"/>
  </xsl:param>

  <!-- ======================================================================
       LaTeXML Identification
       (Maybe bring the Logo back?)
  -->
  <xsl:template name="LaTeXML_identifier">
    <xsl:if test="$LATEXML_VERSION or $TIMESTAMP">
      <xsl:comment>
        <xsl:text>Generated</xsl:text>
        <xsl:if test="$TIMESTAMP">
          <xsl:text> on </xsl:text>
          <xsl:value-of select="$TIMESTAMP"/>
        </xsl:if>
        <xsl:text> by LaTeXML</xsl:text>
        <xsl:if test="$LATEXML_VERSION">
          <xsl:text> (version </xsl:text>
          <xsl:value-of select="$LATEXML_VERSION"/>
          <xsl:text>)</xsl:text>
        </xsl:if>
        <xsl:text> http://dlmf.nist.gov/LaTeXML/.</xsl:text>
      </xsl:comment>
      <xsl:text>&#x0A;</xsl:text>
    </xsl:if>
    <xsl:if test="//ltx:date[@role='creation' or @role='conversion'][1]">
      <xsl:comment>
        <xsl:text>Document created on </xsl:text>
        <xsl:value-of select="translate(//ltx:date/node(),'-','‐')"/>
        <xsl:text>.</xsl:text>
      </xsl:comment>
      <xsl:text>&#x0A;</xsl:text>
    </xsl:if>
  </xsl:template>

  <!-- ======================================================================
       Customization Hooks (for redefinition)
       These are called in each (non-trivial) template within the main result element,
       before and after the content is processed.
       They are sorta "inner" begin & end.
       "Outer" begin & end is easy to do using <xsl:apply-imports/>
  -->
  <xsl:template match="*|/" mode="begin"/>
  <xsl:template match="*|/" mode="end"/>

  <!-- ======================================================================
       Utility functions



( run in 0.915 second using v1.01-cache-2.11-cpan-39bf76dae61 )