Ignore:
Timestamp:
Sep 1, 2010, 12:07:16 AM (9 years ago)
Author:
julian.reschke@…
Message:

bump up document dates, update to latest version of rfc2629.xslt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rfc2629xslt/xsl11toFop.xslt

    r6 r981  
    11<!--
    2     Transform XSL 1.1 extensions to FOP extensions
     2    Transform XSL 1.1 extensions to Apache FOP
    33
    4     Copyright (c) 2006-2007, Julian Reschke (julian.reschke@greenbytes.de)
     4    Copyright (c) 2007-2010, Julian Reschke (julian.reschke@greenbytes.de)
    55    All rights reserved.
    66
     
    3232<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    3333               xmlns:fo="http://www.w3.org/1999/XSL/Format"
    34                xmlns:fox="http://xml.apache.org/fop/extensions"
     34               xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
    3535               version="1.0"
    3636>
    3737
    38 <!-- transform bookmark elements -->
    39 
    40 <xsl:template match="fo:bookmark-tree" >
    41   <xsl:apply-templates/>
    42 </xsl:template>
    43 
    44 <xsl:template match="fo:bookmark" >
    45   <fox:outline internal-destination="{@internal-destination}">
    46     <xsl:apply-templates/>
    47   </fox:outline>
    48 </xsl:template>
    49 
    50 <xsl:template match="fo:bookmark-title" >
    51   <fox:label>
    52     <xsl:apply-templates/>
    53   </fox:label>
    54 </xsl:template>
    55 
    56 
    57 <!-- work around for missing page break stuff -->
    58 
    59 <xsl:template match="fo:block[@page-break-before='always']">
     38<xsl:template match="node()|@*">
    6039  <xsl:copy>
    61     <xsl:attribute name="break-before">page</xsl:attribute>
    62     <xsl:attribute name="keep-with-previous">auto</xsl:attribute>
    63     <xsl:apply-templates select="@*[not(name()='page-break-before') and not(name()='id')]" />
    64     <xsl:apply-templates select="@id" />
     40    <xsl:apply-templates select="@*" />
    6541    <xsl:apply-templates select="node()" />
    6642  </xsl:copy>
    6743</xsl:template>
    6844
    69 <!-- work around weird list item behaviour -->
     45<xsl:template match="/">
     46        <xsl:copy><xsl:apply-templates select="node()" /></xsl:copy>
     47</xsl:template>
    7048
    71 <xsl:template match="fo:list-item-body/fo:block[not(node())]">
     49<xsl:template match="/fo:root">
    7250  <xsl:copy>
    73     <xsl:apply-templates select="@*"/>
    74     <!-- add NBSP so the block is not empty -->
    75     <xsl:text>&#160;</xsl:text>
     51    <xsl:apply-templates select="@*|node()" />
     52    <xsl:for-each select="//@id">
     53      <fox:destination internal-destination="{.}"/>
     54    </xsl:for-each>
    7655  </xsl:copy>
    7756</xsl:template>
    7857
    79 <!-- add destination elements where IDs are defined -->
    80 <xsl:template match="@id">
    81   <xsl:copy-of select="."/>
    82   <fox:destination internal-destination="{.}"/>
    83 </xsl:template>
     58<!-- remove third-party extensions -->
    8459
    85 <xsl:template match="fo:list-item/@id">
    86   <!-- dunno how to in list items, so move into list-item-body -->
    87 </xsl:template>
    88 
    89 <xsl:template match="fo:list-item[@id]/fo:list-item-body">
    90   <xsl:copy>
    91     <xsl:attribute name="id"><xsl:value-of select="../@id"/></xsl:attribute>
    92     <xsl:apply-templates select="@*|node()"/>
    93   </xsl:copy>
    94 </xsl:template>
     60<xsl:template match="*[not(ancestor::fo:declarations) and namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" />
     61<xsl:template match="@*[not(ancestor::fo:declarations) and namespace-uri()!='' and namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" />
    9562
    9663<!-- index-page-citation-list -->
     
    10976      </xsl:if>
    11077      <fo:page-number-citation ref-id="{ancestor-or-self::*/@id}"/>
    111       <xsl:if test="not(ancestor-or-self::*/@id)">
    112         <xsl:message>WARNING: No ID found for <xsl:value-of select="@index-key"/>.</xsl:message>
    113       </xsl:if>
    11478    </fo:basic-link>
    11579    <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>
     
    11781</xsl:template>
    11882
    119 <!-- suppress and map-->
    12083<xsl:template match="@index-key" />
    12184<xsl:template match="fo:index-range-end" />
    12285<xsl:template match="fo:index-range-begin">
    123   <fo:wrapper id="{@id}"/>
     86  <fo:block id="{@id}"/>
    12487</xsl:template>
    125 
    126 <!-- remove stuff not understood -->
    127 <xsl:template match="@page-break-inside"/>
    128 
    129 <!-- remove third-party extensions -->
    130 
    131 <xsl:template match="*[namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" />
    132 <xsl:template match="@*[namespace-uri()!='' and namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" />
    133 
    134 
    135 
    136 <xsl:template match="node()|@*">
    137   <xsl:copy>
    138     <xsl:apply-templates select="@*[not(name()='id')]" />
    139     <xsl:apply-templates select="@id" />
    140     <xsl:apply-templates select="node()" />
    141   </xsl:copy>
    142 </xsl:template>
    143 
    144 <xsl:template match="/">
    145         <xsl:copy><xsl:apply-templates select="node()" /></xsl:copy>
     88<xsl:template match="fo:inline[@id and @index-key and not(node())]">
     89  <xsl:choose>
     90    <xsl:when test="ancestor::fo:block">
     91      <fo:wrapper id="{@id}"/>
     92    </xsl:when>
     93    <xsl:otherwise>
     94      <fo:block id="{@id}"/>
     95    </xsl:otherwise>
     96  </xsl:choose>
    14697</xsl:template>
    14798
Note: See TracChangeset for help on using the changeset viewer.