Paste number 72850: XSLT for TaBA

Paste number 72850: XSLT for TaBA
Pasted by: Arnia
When:1 year, 1 month ago
Share:Tweet this! | http://paste.lisp.org/+1K7M
Channel:#publish
Paste contents:
Raw Source | XML | Display As
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:param name="display_article_keywords" select="''"/>

  <xsl:param name="display_comments" select="''"/>
  <xsl:param name="haloscan_name" select="''"/>

 <xsl:template name="user.head.content.before">
    <xsl:if test="/article/articleinfo/author/personname">
      <xsl:apply-templates mode="head" select="/article/articleinfo/author" />
    </xsl:if>
    <xsl:if test="/article/articleinfo/publisher/publishername">
      <xsl:apply-templates mode="head" select="/article/articleinfo/publisher" />
    </xsl:if>
    <xsl:apply-templates select="//bibliorelation" mode="head"/>
    <link rel="stylesheet" type="text/css" media="all" href="/j.r.c.geldart/style/custom.css"/>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/>
  </xsl:template>
  

  <xsl:template match="abstract">
    <div class="abstract">
      <xsl:apply-templates/>
    </div>
  </xsl:template>

  <xsl:template match="footnote">
    <xsl:variable name="name">
      <xsl:text>citation-</xsl:text>
      <xsl:apply-templates select="." mode="footnote.number"/>
    </xsl:variable>
    <xsl:variable name="href">
      <xsl:text>#footnote-</xsl:text>
      <xsl:apply-templates select="." mode="footnote.number"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="ancestor::tgroup">
        <span class="footnoteWrap">
          <sup>
              <xsl:apply-templates select="." mode="footnote.number"/>
          </sup>
          <xsl:apply-templates/>
        </span>
      </xsl:when>
      <xsl:otherwise>
        <span class="footnoteWrap">
          <sup>
              <xsl:apply-templates select="." mode="footnote.number"/>
          </sup>
          <xsl:apply-templates/>
        </span>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template name="process.footnotes"></xsl:template>

  <xsl:template match="footnote/para[1]|footnote/simpara[1]">
    <xsl:variable name="name">
      <xsl:text>footnote-</xsl:text>
      <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
    </xsl:variable>
    <xsl:variable name="href">
      <xsl:text>#citation-</xsl:text>
      <xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/>
    </xsl:variable>
    <span>
      <span class="footnoteBracket">[</span>
      <sup><xsl:apply-templates select="ancestor::footnote" mode="footnote.number"/></sup>
      <xsl:text> </xsl:text> 
      <xsl:if test="@role and $para.propagates.style != 0">
        <xsl:apply-templates select="." mode="class.attribute">
          <xsl:with-param name="class" select="@role"/>
        </xsl:apply-templates>
      </xsl:if>
      <xsl:apply-templates/>
      <span class="footnoteBracket">]</span>
    </span>
  </xsl:template>


  <xsl:template match="*" mode="titlepage.extended">
    <xsl:param name="display_date"/>
    <xsl:param name="display_author"/>
    <xsl:param name="display_publisher"/>
    <xsl:variable name="date">
      <xsl:choose>
        <xsl:when test="pubdate">
          <xsl:apply-templates mode="titlepage.mode" select="pubdate"/>
        </xsl:when>
        <xsl:when test="//articleinfo/pubdate">
          <xsl:apply-templates mode="titlepage.mode" select="//articleinfo/pubdate"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="keywords">
      <xsl:choose>
        <xsl:when test="keywordset">
          <xsl:apply-templates mode="titlepage.mode" select="keywordset/keyword"/>
        </xsl:when>
        <xsl:when test="//articleinfo/keywordset">
          <xsl:apply-templates mode="titlepage.mode" select="//articleinfo/keywordset/keyword"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="author">
      <xsl:choose>
        <xsl:when test="author">
          <xsl:apply-templates mode="titlepage.mode" select="author"/>
        </xsl:when>
        <xsl:when test="//articleinfo/author">
          <xsl:apply-templates mode="titlepage.mode" select="//articleinfo/author"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="publisher">
      <xsl:choose>
        <xsl:when test="publisher">
          <xsl:apply-templates mode="titlepage.mode" select="publisher"/>
        </xsl:when>
        <xsl:when test="//articleinfo/publisher">
          <xsl:apply-templates mode="titlepage.mode" select="//articleinfo/publisher"/>
        </xsl:when>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="use_date" select="$display_date = 'on' and $date"/>
    <xsl:variable name="use_author" select="$display_author = 'on' and $author"/>
    <xsl:variable name="use_publisher" select="$display_publisher = 'on' and $publisher"/>
    <xsl:variable name="use_keywords" select="$display_article_keywords = 'on' and $keywords"/>
    <xsl:if test="$use_date or $use_author or $use_publisher or $use_keywords">
      <dl class="articleMetadata">
        <xsl:choose>
          <xsl:when test="$use_date">
            <dt class="articlePublicationLabel">
              <xsl:value-of select="p:gettext('Published on')"/>
            </dt>
            <dd class="articlePublicationData">
              <xsl:copy-of select="$date" />
            </dd>
            <xsl:if test="$use_author or $use_publisher">
              <dt class="articleAuthPubLabel">
                <xsl:value-of select="p:gettext('by')"/>
              </dt>
            </xsl:if>
          </xsl:when>
          <xsl:otherwise>
            <xsl:choose>
              <xsl:when test="$use_author">
                <dt class="articleAuthorLabel">
                  <xsl:value-of select="p:gettext('Written by')"/>
                </dt>
              </xsl:when>
              <xsl:when test="$use_publisher">
                <dt class="articlePublisherLabel">
                  <xsl:value-of select="p:gettext('Published by')"/>
                </dt>
              </xsl:when>
            </xsl:choose>
          </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="$use_author">
          <dd class="articleAuthorData">
            <xsl:copy-of select="$author"/>
            <xsl:if test="$use_publisher">
              <xsl:text>, </xsl:text>
            </xsl:if>
          </dd>
        </xsl:if>
        <xsl:if test="$use_publisher">
          <dd class="articlePublisherData">
            <xsl:copy-of select="$publisher" />
          </dd>
        </xsl:if>
        <xsl:if test="$use_keywords">
          <dt class="articleKeywordsLabel">
            <xsl:text>Keywords</xsl:text>
          </dt>
          <dd class="articleKeywordsData">
            <ul>
              <!--<xsl:for-each select="$keywords">
                <li><xsl:apply-templates/></li>
              </xsl:for-each>-->
            </ul>
          </dd>
        </xsl:if>
      </dl>
    </xsl:if>
  </xsl:template>


  <xsl:template match="//section/sectioninfo/title/ulink">
    <a>
      <xsl:attribute name="href">
        <xsl:value-of select="@url"/>
        <xsl:text>.html</xsl:text>
      </xsl:attribute>
      <xsl:apply-templates/>
    </a>
  </xsl:template>



</xsl:stylesheet>

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.