github.com/matislovas/ratago@v0.0.0-20240408115641-cc0857415a7a/xslt/testdata/general/bug-125.xsl (about)

     1  <?xml version="1.0" encoding="UTF-8"?>
     2  <xsl:stylesheet version="1.0"
     3                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     4  
     5    <xsl:strip-space elements="*" />
     6    <xsl:output method="html" indent="no"/>
     7  
     8    <xsl:template match="/">
     9      <div class="errataset">
    10        <xsl:text>&#x0a;</xsl:text>
    11        <xsl:for-each select="errataset/errata">
    12          <xsl:sort select="@page" data-type="number" />
    13          <xsl:sort select="@paragraph" data-type="number" />
    14          <xsl:sort select="@line" data-type="number" />
    15          <xsl:apply-templates select="." />
    16        </xsl:for-each>
    17      </div>
    18    </xsl:template>
    19  
    20    <xsl:template name="errata" match="errata">
    21      <div class="errata"><xsl:text>&#x0a;</xsl:text>
    22        <xsl:call-template name="show-attributes" />
    23        <xsl:for-each select="*|text()">
    24          <xsl:apply-templates select="."/>
    25        </xsl:for-each>
    26      </div><xsl:text>&#x0a;</xsl:text>
    27    </xsl:template>
    28  
    29    <xsl:template match="text()">
    30      <xsl:if test="string-length(normalize-space(.))">
    31        <p style="clear: both; padding: 3px;">
    32          <xsl:value-of select="normalize-space(.)" />
    33        </p>
    34        <xsl:text>&#x0a;</xsl:text>
    35      </xsl:if>
    36    </xsl:template>
    37  
    38    <xsl:template name="explanation" match="explanation">
    39      <blockquote class="explanation"><xsl:text>&#x0a;</xsl:text>
    40        <p><xsl:text>&#x0a;</xsl:text>
    41          <xsl:value-of select="normalize-space(text())" />
    42          <xsl:text>&#x0a;</xsl:text>
    43        </p><xsl:text>&#x0a;</xsl:text>
    44      </blockquote><xsl:text>&#x0a;</xsl:text>
    45    </xsl:template>
    46  
    47    <xsl:template name="show-attributes">
    48      <table class="location-type" cellspacing="0" cellpadding="2">
    49        <xsl:text>&#x0a;</xsl:text>
    50        <xsl:choose>
    51          <xsl:when test="@paragraph">
    52            <xsl:choose>
    53              <xsl:when test="@line">
    54                <tr>
    55                  <td style="width: 15%;" class="page">Page: <xsl:value-of select="@page" /></td>
    56                  <xsl:text>&#x0a;</xsl:text>
    57                  <td style="width: 15%;" class="paragraph">Paragraph: <xsl:value-of select="@paragraph" /></td>
    58                  <xsl:text>&#x0a;</xsl:text>
    59                  <td style="width: 15%;" class="line">Line: <xsl:value-of select="@line" /></td>
    60                  <xsl:text>&#x0a;</xsl:text>
    61                  <td style="width: 55%;" class="type"><xsl:value-of select="@type" /></td>
    62                  <xsl:text>&#x0a;</xsl:text>
    63                </tr><xsl:text>&#x0a;</xsl:text>
    64              </xsl:when>
    65              <xsl:otherwise>
    66                <tr>
    67                  <td style="width: 15%;" class="page">Page: <xsl:value-of select="@page" /></td>
    68                  <xsl:text>&#x0a;</xsl:text>
    69                  <td style="width: 15%;" class="paragraph">Paragraph: <xsl:value-of select="@paragraph" /></td>
    70                  <xsl:text>&#x0a;</xsl:text>
    71                  <td style="width: 70%;" class="type"><xsl:value-of select="@type" /></td>
    72                  <xsl:text>&#x0a;</xsl:text>
    73                </tr><xsl:text>&#x0a;</xsl:text>
    74              </xsl:otherwise>
    75            </xsl:choose>
    76          </xsl:when>
    77          <xsl:when test="@line">
    78            <tr><xsl:text>&#x0a;</xsl:text>
    79              <td style="width: 15%;" class="page">Page: <xsl:value-of select="@page" /></td>
    80              <xsl:text>&#x0a;</xsl:text>
    81              <td style="width: 15%;" class="line">Line: <xsl:value-of select="@line" /></td>
    82              <xsl:text>&#x0a;</xsl:text>
    83              <td style="width: 70%;" class="type"><xsl:value-of select="@type" /></td>
    84              <xsl:text>&#x0a;</xsl:text>
    85            </tr><xsl:text>&#x0a;</xsl:text>
    86          </xsl:when>
    87          <xsl:otherwise>
    88            <tr>
    89              <td style="width: 15%;" class="page">Page: <xsl:value-of select="@page" /></td>
    90              <xsl:text>&#x0a;</xsl:text>
    91              <td style="width: 85%;" class="type"><xsl:value-of select="@type" /></td>
    92              <xsl:text>&#x0a;</xsl:text>
    93            </tr><xsl:text>&#x0a;</xsl:text>
    94          </xsl:otherwise>
    95        </xsl:choose>
    96      </table><xsl:text>&#x0a;</xsl:text>
    97    </xsl:template>
    98  
    99  </xsl:stylesheet>