[6] | 1 | <!-- |
---|
| 2 | Transform XSL 1.1 extensions to FOP 0.93 |
---|
| 3 | |
---|
| 4 | Copyright (c) 2007, 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://xml.apache.org/fop/extensions" |
---|
| 35 | version="1.0" |
---|
| 36 | > |
---|
| 37 | |
---|
| 38 | <xsl:template match="node()|@*"> |
---|
| 39 | <xsl:copy> |
---|
| 40 | <xsl:apply-templates select="@*[not(name()='id')]" /> |
---|
| 41 | <xsl:apply-templates select="@id" /> |
---|
| 42 | <xsl:apply-templates select="node()" /> |
---|
| 43 | </xsl:copy> |
---|
| 44 | </xsl:template> |
---|
| 45 | |
---|
| 46 | <xsl:template match="/"> |
---|
| 47 | <xsl:copy><xsl:apply-templates select="node()" /></xsl:copy> |
---|
| 48 | </xsl:template> |
---|
| 49 | |
---|
| 50 | <!-- remove third-party extensions --> |
---|
| 51 | |
---|
| 52 | <xsl:template match="*[namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" /> |
---|
| 53 | <xsl:template match="@*[namespace-uri()!='' and namespace-uri()!='http://www.w3.org/1999/XSL/Format' and namespace-uri()!='http://xml.apache.org/fop/extensions']" /> |
---|
| 54 | |
---|
| 55 | <!-- index-page-citation-list --> |
---|
| 56 | |
---|
| 57 | <xsl:attribute-set name="internal-link"> |
---|
| 58 | <xsl:attribute name="color">#000080</xsl:attribute> |
---|
| 59 | </xsl:attribute-set> |
---|
| 60 | |
---|
| 61 | <xsl:template match="fo:index-page-citation-list"> |
---|
| 62 | <xsl:variable name="items" select="fo:index-key-reference"/> |
---|
| 63 | <xsl:variable name="entries" select="//*[@index-key=$items/@ref-index-key]"/> |
---|
| 64 | <xsl:for-each select="$entries"> |
---|
| 65 | <fo:basic-link internal-destination="{ancestor-or-self::*/@id}" xsl:use-attribute-sets="internal-link"> |
---|
| 66 | <xsl:if test="contains(@index-key,',primary') and substring-after(@index-key,',primary')=''"> |
---|
| 67 | <xsl:attribute name="font-weight">bold</xsl:attribute> |
---|
| 68 | </xsl:if> |
---|
| 69 | <fo:page-number-citation ref-id="{ancestor-or-self::*/@id}"/> |
---|
| 70 | </fo:basic-link> |
---|
| 71 | <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> |
---|
| 72 | </xsl:for-each> |
---|
| 73 | </xsl:template> |
---|
| 74 | |
---|
| 75 | <!-- suppress and map, see also http://issues.apache.org/bugzilla/show_bug.cgi?id=42423 --> |
---|
| 76 | <xsl:template match="@index-key" /> |
---|
| 77 | <xsl:template match="fo:index-range-end" /> |
---|
| 78 | <xsl:template match="fo:index-range-begin"> |
---|
| 79 | <fo:block id="{@id}"/> |
---|
| 80 | </xsl:template> |
---|
| 81 | <xsl:template match="fo:inline[@id and @index-key and not(node())]"> |
---|
| 82 | <fo:block id="{@id}"/> |
---|
| 83 | </xsl:template> |
---|
| 84 | |
---|
| 85 | </xsl:transform> |
---|