Statistics
| Revision:

root / tmp / org.txm.core / res / org / txm / xml / xsl / tei / fo2 / linking.xsl @ 187

History | View | Annotate | Download (5.1 kB)

1
<?xml version="1.0" encoding="utf-8"?>
2
<xsl:stylesheet 
3
                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
4
                xmlns="http://www.w3.org/1999/XSL/Format"
5
		xmlns:xs="http://www.w3.org/2001/XMLSchema"                
6
                xmlns:rng="http://relaxng.org/ns/structure/1.0"
7
                xmlns:tei="http://www.tei-c.org/ns/1.0"
8
                xmlns:teix="http://www.tei-c.org/ns/Examples"
9
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10
                exclude-result-prefixes="a rng tei teix xs"
11
                version="2.0">
12
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
13
      <desc>
14
         <p>
15
    TEI stylesheet
16
    dealing  with elements from the
17
      linking module, making XSL-FO output.
18
      </p>
19
         <p>This software is dual-licensed:
20

    
21
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
22
Unported License http://creativecommons.org/licenses/by-sa/3.0/ 
23

    
24
2. http://www.opensource.org/licenses/BSD-2-Clause
25
		
26
All rights reserved.
27

    
28
Redistribution and use in source and binary forms, with or without
29
modification, are permitted provided that the following conditions are
30
met:
31

    
32
* Redistributions of source code must retain the above copyright
33
notice, this list of conditions and the following disclaimer.
34

    
35
* Redistributions in binary form must reproduce the above copyright
36
notice, this list of conditions and the following disclaimer in the
37
documentation and/or other materials provided with the distribution.
38

    
39
This software is provided by the copyright holders and contributors
40
"as is" and any express or implied warranties, including, but not
41
limited to, the implied warranties of merchantability and fitness for
42
a particular purpose are disclaimed. In no event shall the copyright
43
holder or contributors be liable for any direct, indirect, incidental,
44
special, exemplary, or consequential damages (including, but not
45
limited to, procurement of substitute goods or services; loss of use,
46
data, or profits; or business interruption) however caused and on any
47
theory of liability, whether in contract, strict liability, or tort
48
(including negligence or otherwise) arising in any way out of the use
49
of this software, even if advised of the possibility of such damage.
50
</p>
51
         <p>Author: See AUTHORS</p>
52
         <p>Id: $Id: linking.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
53
         <p>Copyright: 2011, TEI Consortium</p>
54
      </desc>
55
   </doc>
56
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
57
      <desc>[fo] <param name="where">target of link</param>
58
      </desc>
59
   </doc>
60
  <xsl:template name="generateEndLink">
61
      <xsl:param name="where"/>
62
      <xsl:value-of select="$where"/>
63
  </xsl:template>
64
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
65
      <desc>[fo] <param name="ptr">whether the destination URL is also the body
66
    of the link</param>
67
         <param name="dest">destination URL</param>
68
      </desc>
69
   </doc>
70
  <xsl:template name="makeExternalLink">
71
      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
72
      <xsl:param name="dest"/>
73
      <basic-link external-destination="url({$dest})">
74
         <xsl:choose>
75
            <xsl:when test="$ptr">
76
               <xsl:call-template name="showXrefURL">
77
                  <xsl:with-param name="dest">
78
                     <xsl:value-of select="$dest"/>
79
                  </xsl:with-param>
80
               </xsl:call-template>
81
            </xsl:when>
82
            <xsl:otherwise>
83
               <xsl:apply-templates/>
84
            </xsl:otherwise>
85
         </xsl:choose>
86
      </basic-link>
87
  </xsl:template>
88
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
89
      <desc>[fo] <param name="ptr">ptr</param>
90
         <param name="target">target</param>
91
         <param name="dest">destination</param>
92
         <param name="body">body</param>
93
      </desc>
94
   </doc>
95
  <xsl:template name="makeInternalLink">
96
      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
97
      <xsl:param name="class"/>
98
      <xsl:param name="target"/>
99
      <xsl:param name="dest"/>
100
      <xsl:param name="body"/>
101
      <xsl:variable name="W">
102
         <xsl:choose>
103
            <xsl:when test="$target">
104
               <xsl:value-of select="$target"/>
105
            </xsl:when>
106
            <xsl:when test="contains($dest,'#')">
107
               <xsl:value-of select="substring($dest,2)"/>
108
            </xsl:when>
109
            <xsl:otherwise>
110
               <xsl:value-of select="$dest"/>
111
            </xsl:otherwise>
112
         </xsl:choose>
113
      </xsl:variable>
114
      <basic-link internal-destination="{$W}">
115
         <xsl:call-template name="linkStyle"/>
116
         <xsl:choose>
117
            <xsl:when test="not($body='')">
118
               <xsl:value-of select="$body"/>
119
            </xsl:when>
120
            <xsl:when test="$ptr">
121
               <xsl:apply-templates mode="xref" select="id($W)">
122
                  <xsl:with-param name="minimal" select="$minimalCrossRef"/>
123
               </xsl:apply-templates>
124
            </xsl:when>
125
            <xsl:otherwise>
126
               <xsl:apply-templates/>
127
            </xsl:otherwise>
128
         </xsl:choose>
129
      </basic-link>
130
  </xsl:template>
131
</xsl:stylesheet>