source: rfc2629xslt/xsl11toFop.xslt @ 1368

Last change on this file since 1368 was 981, checked in by julian.reschke@…, 9 years ago

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

  • Property svn:eol-style set to native
File size: 4.0 KB
Line 
1<!--
2    Transform XSL 1.1 extensions to Apache FOP
3
4    Copyright (c) 2007-2010, Julian Reschke (julian.reschke@greenbytes.de)
5    All rights reserved.
6
7    Redistribution and use in source and binary forms, with or without
8    modification, are permitted provided that the following conditions are met:
9
10    * Redistributions of source code must retain the above copyright notice,
11      this list of conditions and the following disclaimer.
12    * Redistributions in binary form must reproduce the above copyright notice,
13      this list of conditions and the following disclaimer in the documentation
14      and/or other materials provided with the distribution.
15    * Neither the name of Julian Reschke nor the names of its contributors
16      may be used to endorse or promote products derived from this software
17      without specific prior written permission.
18
19    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29    POSSIBILITY OF SUCH DAMAGE.
30-->
31
32<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
33               xmlns:fo="http://www.w3.org/1999/XSL/Format"
34               xmlns:fox="http://xmlgraphics.apache.org/fop/extensions"
35               version="1.0"
36>
37
38<xsl:template match="node()|@*">
39  <xsl:copy>
40    <xsl:apply-templates select="@*" />
41    <xsl:apply-templates select="node()" />
42  </xsl:copy>
43</xsl:template>
44
45<xsl:template match="/">
46        <xsl:copy><xsl:apply-templates select="node()" /></xsl:copy>
47</xsl:template>
48
49<xsl:template match="/fo:root">
50  <xsl:copy>
51    <xsl:apply-templates select="@*|node()" />
52    <xsl:for-each select="//@id">
53      <fox:destination internal-destination="{.}"/>
54    </xsl:for-each>
55  </xsl:copy>
56</xsl:template>
57
58<!-- remove third-party extensions -->
59
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']" />
62
63<!-- index-page-citation-list -->
64
65<xsl:attribute-set name="internal-link">
66  <xsl:attribute name="color">#000080</xsl:attribute>
67</xsl:attribute-set>
68
69<xsl:template match="fo:index-page-citation-list">
70  <xsl:variable name="items" select="fo:index-key-reference"/>
71  <xsl:variable name="entries" select="//*[@index-key=$items/@ref-index-key]"/>
72  <xsl:for-each select="$entries">
73    <fo:basic-link internal-destination="{ancestor-or-self::*/@id}" xsl:use-attribute-sets="internal-link">
74      <xsl:if test="contains(@index-key,',primary') and substring-after(@index-key,',primary')=''">
75        <xsl:attribute name="font-weight">bold</xsl:attribute>
76      </xsl:if>
77      <fo:page-number-citation ref-id="{ancestor-or-self::*/@id}"/>
78    </fo:basic-link>
79    <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if>
80  </xsl:for-each>
81</xsl:template>
82
83<xsl:template match="@index-key" />
84<xsl:template match="fo:index-range-end" />
85<xsl:template match="fo:index-range-begin">
86  <fo:block id="{@id}"/>
87</xsl:template>
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>
97</xsl:template>
98
99</xsl:transform>
Note: See TracBrowser for help on using the repository browser.