Ignore:
Timestamp:
Oct 11, 2008, 12:06:15 AM (11 years ago)
Author:
julian.reschke@…
Message:

update to latest version of rfc2629.xslt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rfc2629xslt/rfc2629toFO.xslt

    r285 r329  
    4747<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
    4848
     49<!-- page sizes as per <http://tools.ietf.org/html/draft-rfc-editor-rfc2223bis-08#section-3.2> -->
     50<xsl:attribute-set name="page">
     51  <xsl:attribute name="margin-left">1in</xsl:attribute>
     52  <xsl:attribute name="margin-right">1in</xsl:attribute>
     53  <xsl:attribute name="page-height">11in</xsl:attribute>
     54  <xsl:attribute name="page-width">8.5in</xsl:attribute>
     55</xsl:attribute-set>
     56
    4957<xsl:attribute-set name="base">
    5058        <xsl:attribute name="font-family">serif</xsl:attribute>
    5159        <xsl:attribute name="font-size">10pt</xsl:attribute>
     60        <xsl:attribute name="line-height">12pt</xsl:attribute>
    5261</xsl:attribute-set>
    5362
     
    152161    </xsl:otherwise>
    153162  </xsl:choose>
     163 
     164  <xsl:if test="@align='center'">
     165    <xsl:attribute name="text-align">center</xsl:attribute>
     166  </xsl:if>
    154167</xsl:template>
    155168
     
    168181
    169182<xsl:template match="author">
    170   <fo:block space-before="1em">
    171     <fo:wrapper font-weight="bold"><xsl:value-of select="@fullname" /></fo:wrapper>
    172     <xsl:if test="@role">
    173       <fo:wrapper> (<xsl:value-of select="@role" />)</fo:wrapper>
     183  <fo:block start-indent="2em" space-before=".5em" space-after=".5em">
     184    <fo:block>
     185      <fo:wrapper font-weight="bold"><xsl:value-of select="@fullname" /></fo:wrapper>
     186      <xsl:if test="@role">
     187        <fo:wrapper> (<xsl:value-of select="@role" />)</fo:wrapper>
     188      </xsl:if>
     189    </fo:block>
     190    <fo:block><xsl:value-of select="organization" /></fo:block>
     191        <xsl:for-each select="address/postal/street">
     192      <fo:block><xsl:value-of select="." /></fo:block>
     193    </xsl:for-each>
     194        <xsl:if test="address/postal/city">
     195      <fo:block><xsl:value-of select="concat(address/postal/city,', ',address/postal/region,' ',address/postal/code)" /></fo:block>
     196        </xsl:if>
     197        <xsl:if test="address/postal/country">
     198      <fo:block><xsl:value-of select="address/postal/country" /></fo:block>
    174199    </xsl:if>
     200        <xsl:if test="address/phone">
     201      <fo:block>Phone:&#0160;<fo:basic-link external-destination="url('tel:{translate(address/phone,' ','')}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="address/phone" /></fo:basic-link></fo:block>
     202    </xsl:if>
     203        <xsl:if test="address/facsimile">
     204      <fo:block>Fax:&#0160;<fo:basic-link external-destination="url('tel:{translate(address/facsimile,' ','')}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="address/facsimile" /></fo:basic-link></fo:block>
     205    </xsl:if>
     206        <xsl:for-each select="address/email">
     207      <xsl:variable name="email">
     208        <xsl:call-template name="extract-email"/>
     209      </xsl:variable>
     210      <fo:block>EMail:&#0160;
     211        <xsl:choose>
     212          <xsl:when test="$xml2rfc-linkmailto='no'">
     213              <xsl:value-of select="$email" />
     214          </xsl:when>
     215          <xsl:otherwise>
     216            <fo:basic-link external-destination="url('mailto:{$email}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="$email" /></fo:basic-link>
     217          </xsl:otherwise>
     218        </xsl:choose>
     219      </fo:block>
     220    </xsl:for-each>
     221        <xsl:for-each select="address/uri">
     222      <xsl:variable name="uri">
     223        <xsl:call-template name="extract-uri"/>
     224      </xsl:variable>
     225      <fo:block>URI:&#0160;<fo:basic-link external-destination="url('{$uri}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="$uri" /></fo:basic-link></fo:block>
     226    </xsl:for-each>
    175227  </fo:block>
    176   <fo:block><xsl:value-of select="organization" /></fo:block>
    177         <xsl:for-each select="address/postal/street">
    178     <fo:block><xsl:value-of select="." /></fo:block>
    179   </xsl:for-each>
    180         <xsl:if test="address/postal/city">
    181     <fo:block><xsl:value-of select="concat(address/postal/city,', ',address/postal/region,' ',address/postal/code)" /></fo:block>
    182         </xsl:if>
    183         <xsl:if test="address/postal/country">
    184     <fo:block><xsl:value-of select="address/postal/country" /></fo:block>
    185   </xsl:if>
    186         <xsl:if test="address/phone">
    187     <fo:block>Phone:&#0160;<fo:basic-link external-destination="url('tel:{translate(address/phone,' ','')}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="address/phone" /></fo:basic-link></fo:block>
    188   </xsl:if>
    189         <xsl:if test="address/facsimile">
    190     <fo:block>Fax:&#0160;<fo:basic-link external-destination="url('tel:{translate(address/facsimile,' ','')}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="address/facsimile" /></fo:basic-link></fo:block>
    191   </xsl:if>
    192         <xsl:for-each select="address/email">
    193     <xsl:variable name="email">
    194       <xsl:call-template name="extract-email"/>
    195     </xsl:variable>
    196     <fo:block>EMail:&#0160;
    197       <xsl:choose>
    198         <xsl:when test="$xml2rfc-linkmailto='no'">
    199             <xsl:value-of select="$email" />
    200         </xsl:when>
    201         <xsl:otherwise>
    202           <fo:basic-link external-destination="url('mailto:{$email}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="$email" /></fo:basic-link>
    203         </xsl:otherwise>
    204       </xsl:choose>
    205     </fo:block>
    206   </xsl:for-each>
    207         <xsl:for-each select="address/uri">
    208     <xsl:variable name="uri">
    209       <xsl:call-template name="extract-uri"/>
    210     </xsl:variable>
    211     <fo:block>URI:&#0160;<fo:basic-link external-destination="url('{$uri}')" xsl:use-attribute-sets="external-link"><xsl:value-of select="$uri" /></fo:basic-link></fo:block>
    212   </xsl:for-each>
    213228</xsl:template>
    214229
     
    516531<xsl:template match="list">
    517532  <xsl:if test="@style!='' and @style!='empty' and @style">
    518     <xsl:message>WARNING: unknown style '<xsl:value-of select="@style"/>' for list, continueing with default format.</xsl:message>
     533    <xsl:call-template name="warning">
     534      <xsl:with-param name="inline" select="'no'"/>
     535      <xsl:with-param name="msg">unknown style '<xsl:value-of select="@style"/>' for list, continueing with default format.</xsl:with-param>
     536    </xsl:call-template>
    519537  </xsl:if>
    520538  <fo:list-block provisional-distance-between-starts="2em">
     
    850868        <fo:root xsl:use-attribute-sets="base">
    851869   
    852     <!-- insert PDF information (XEP extension) -->
    853     <meta-info xmlns="http://www.renderx.com/XSL/Extensions">
    854       <!-- title -->
    855       <meta-field name="title" value="{/rfc/front/title}"/>
    856       <!-- keywords -->
    857       <xsl:if test="/rfc/front/keyword">
    858         <xsl:variable name="keyw">
    859           <xsl:call-template name="get-keywords" />
    860         </xsl:variable>
    861         <meta-field name="keywords" value="{$keyw}" />
    862       </xsl:if>
    863       <xsl:variable name="auth">
    864         <xsl:call-template name="get-author-summary" />
    865       </xsl:variable>
    866       <meta-field name="author" value="{$auth}" />
    867     </meta-info>
    868 
    869870                <fo:layout-master-set>
    870       <!-- page sizes as per <http://tools.ietf.org/html/draft-rfc-editor-rfc2223bis-08> -->
    871                         <fo:simple-page-master master-name="first-page" margin-left="1in" margin-right="1in" page-height="11in" page-width="8.5in">
     871                        <fo:simple-page-master master-name="first-page" xsl:use-attribute-sets="page">
    872872        <fo:region-body margin-bottom="1in" margin-top="1in"/>
    873873            <fo:region-after extent="1cm" region-name="footer"/>
    874874      </fo:simple-page-master>
    875                         <fo:simple-page-master master-name="other-pages" margin-left="1in" margin-right="1in" page-height="11in" page-width="8.5in">
     875                        <fo:simple-page-master master-name="other-pages" xsl:use-attribute-sets="page">
    876876        <fo:region-body margin-bottom="1in" margin-top="1in" />
    877877                                <fo:region-before extent="1cm" region-name="header"/>
    878878                                <fo:region-after extent="1cm" region-name="footer"/>
    879879      </fo:simple-page-master>
    880                         <fo:simple-page-master master-name="other-pages-dc" margin-left="1in" margin-right="1in" page-height="11in" page-width="8.5in">
     880                        <fo:simple-page-master master-name="other-pages-dc" xsl:use-attribute-sets="page">
    881881        <fo:region-body margin-bottom="1in" margin-top="1in" column-count="2"/>
    882882                                <fo:region-before extent="1cm" region-name="header"/>
     
    889889                </fo:layout-master-set>
    890890
     891    <fo:declarations>
     892      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
     893        <rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">
     894          <dc:title><xsl:value-of select="/rfc/front/title"/></dc:title>
     895          <dc:creator><xsl:call-template name="get-author-summary" /></dc:creator>
     896          <dc:description><xsl:value-of select="normalize-space(/rfc/front/abstract)"/></dc:description>
     897          <xsl:if test="/rfc/front/keyword" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
     898            <pdf:Keywords>
     899              <xsl:for-each select="/rfc/front/keyword">
     900                <xsl:value-of select="."/>
     901                <xsl:if test="position()!=last()">, </xsl:if>
     902              </xsl:for-each>
     903            </pdf:Keywords>
     904          </xsl:if>
     905        </rdf:Description>
     906      </rdf:RDF>
     907    </fo:declarations>
     908   
    891909    <fo:bookmark-tree>
    892910      <xsl:apply-templates select="." mode="bookmarks" />
     
    10141032    <xsl:choose>
    10151033      <xsl:when test="parent::x:blockquote">
     1034        <xsl:attribute name="start-indent">4em</xsl:attribute>
     1035      </xsl:when>
     1036      <xsl:when test="parent::x:note">
    10161037        <xsl:attribute name="start-indent">4em</xsl:attribute>
    10171038      </xsl:when>
     
    11091130        <xsl:value-of select="." />
    11101131      </fo:basic-link>
    1111       <xsl:for-each select="//reference[@anchor=$target]">
    1112         &#160;<xsl:call-template name="referencename"><xsl:with-param name="node" select="." /></xsl:call-template>
    1113       </xsl:for-each>
     1132      <xsl:if test="not(@format='none')">
     1133        <xsl:for-each select="//reference[@anchor=$target]">
     1134          &#160;<xsl:call-template name="referencename"><xsl:with-param name="node" select="." /></xsl:call-template>
     1135        </xsl:for-each>
     1136      </xsl:if>
    11141137    </xsl:otherwise>
    11151138  </xsl:choose>
     
    13761399  </xsl:variable>
    13771400
    1378         <fo:block id="{$anchor-prefix}.authors" xsl:use-attribute-sets="h1 newpage">
    1379     <xsl:if test="$sectionNumber != ''">
    1380       <xsl:call-template name="emit-section-number">
    1381         <xsl:with-param name="no" select="$sectionNumber"/>
    1382       </xsl:call-template>
    1383       <xsl:text>&#0160;&#0160;</xsl:text>
    1384     </xsl:if>
    1385     <xsl:call-template name="get-authors-section-title"/>
    1386   </fo:block>
    1387 
    1388   <xsl:apply-templates select="/rfc/front/author" />
     1401  <xsl:if test="$sectionNumber!='suppress'">
     1402    <fo:block id="{$anchor-prefix}.authors" xsl:use-attribute-sets="h1 newpage">
     1403      <xsl:if test="$sectionNumber != ''">
     1404        <xsl:call-template name="emit-section-number">
     1405          <xsl:with-param name="no" select="$sectionNumber"/>
     1406        </xsl:call-template>
     1407        <xsl:text>&#0160;&#0160;</xsl:text>
     1408      </xsl:if>
     1409      <xsl:call-template name="get-authors-section-title"/>
     1410    </fo:block>
     1411   
     1412    <xsl:apply-templates select="/rfc/front/author" />
     1413  </xsl:if>
    13891414</xsl:template>
    13901415
     
    16281653    <xsl:call-template name="get-authors-section-number"/>
    16291654  </xsl:variable>
    1630   <xsl:call-template name="insert-toc-line">
    1631     <xsl:with-param name="target" select="concat($anchor-prefix,'.authors')"/>
    1632     <xsl:with-param name="title" select="$authors-title"/>
    1633     <xsl:with-param name="number" select="$authors-number"/>
    1634   </xsl:call-template>
     1655  <xsl:if test="$authors-number!='suppress'">
     1656    <xsl:call-template name="insert-toc-line">
     1657      <xsl:with-param name="target" select="concat($anchor-prefix,'.authors')"/>
     1658      <xsl:with-param name="title" select="$authors-title"/>
     1659      <xsl:with-param name="number" select="$authors-number"/>
     1660    </xsl:call-template>
     1661  </xsl:if>
    16351662
    16361663</xsl:template>
     
    18831910  <xsl:apply-templates />
    18841911</xsl:template>
     1912<xsl:template match="ed:issueref">
     1913  <xsl:apply-templates />
     1914</xsl:template>
    18851915
    18861916<xsl:template match="ed:replace">
     
    19772007  </xsl:variable>
    19782008
    1979   <fo:bookmark internal-destination="{concat($anchor-prefix,'.authors')}">
    1980     <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
    1981   </fo:bookmark>
     2009  <xsl:if test="$authors-number!='suppress'">
     2010    <fo:bookmark internal-destination="{concat($anchor-prefix,'.authors')}">
     2011      <fo:bookmark-title><xsl:value-of select="$title"/></fo:bookmark-title>
     2012    </fo:bookmark>
     2013  </xsl:if>
    19822014</xsl:template>
    19832015
     
    19942026
    19952027  <xsl:choose>
     2028    <xsl:when test="count(/*/back/references) = 0">
     2029      <!-- nothing to do -->
     2030    </xsl:when>
    19962031    <xsl:when test="count(/*/back/references) = 1">
    19972032      <xsl:for-each select="/*/back/references">
     
    20702105  <xsl:apply-templates select="front/note" mode="bookmarks"/>
    20712106
    2072   <xsl:if test="$xml2rfc-toc">
     2107  <xsl:if test="$xml2rfc-toc='yes'">
    20732108    <fo:bookmark internal-destination="{concat($anchor-prefix,'.toc')}">
    20742109      <fo:bookmark-title>Table of Contents</fo:bookmark-title>
     
    21532188        </fo:table-column>
    21542189      </xsl:for-each>
    2155       <fo:table-header start-indent="0em" space-after=".5em">
    2156         <fo:table-row>
    2157           <xsl:apply-templates select="ttcol" />
    2158         </fo:table-row>
    2159       </fo:table-header>
     2190      <xsl:if test="ttcol!=''">
     2191        <!-- skip header when all column titles are empty -->
     2192        <fo:table-header start-indent="0em" space-after=".5em">
     2193          <fo:table-row>
     2194            <xsl:apply-templates select="ttcol" />
     2195          </fo:table-row>
     2196        </fo:table-header>
     2197      </xsl:if>
    21602198      <fo:table-body start-indent="0em">
    21612199        <xsl:if test="$style='full' or $style='headers'">
     
    23272365    </xsl:when>
    23282366    <xsl:otherwise>
    2329       <xsl:message>WARNING: internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:message>
     2367      <xsl:call-template name="warning">
     2368        <xsl:with-param name="inline" select="'no'"/>
     2369        <xsl:with-param name="msg">internal link target for '<xsl:value-of select="."/>' does not exist.</xsl:with-param>
     2370      </xsl:call-template>
    23302371      <xsl:apply-templates/>
    23312372    </xsl:otherwise>
     
    23362377<xsl:template match="x:bcp14">
    23372378  <!-- figure out something that prints well -->
     2379  <xsl:apply-templates/>
     2380</xsl:template>
     2381
     2382<!-- Notes -->
     2383<xsl:template match="x:note">
    23382384  <xsl:apply-templates/>
    23392385</xsl:template>
     
    23642410<!-- Headings -->
    23652411<xsl:template match="x:h">
     2412  <fo:wrapper font-weight="bold">
     2413    <xsl:apply-templates/>
     2414  </fo:wrapper>
     2415</xsl:template>
     2416
     2417<!-- Highlightinghing -->
     2418<xsl:template match="x:highlight">
    23662419  <fo:wrapper font-weight="bold">
    23672420    <xsl:apply-templates/>
     
    24372490<xsl:template match="x:bt|x:bc|x:bb">
    24382491  <xsl:apply-templates />
     2492</xsl:template>
     2493
     2494<!-- author handling extensions -->
     2495<xsl:template match="x:include-author">
     2496  <xsl:for-each select="/*/front/author[@anchor=current()/@target]">
     2497    <xsl:apply-templates select="."/>
     2498  </xsl:for-each>
    24392499</xsl:template>
    24402500
Note: See TracChangeset for help on using the changeset viewer.