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 187 sjacqu01
<?xml version="1.0" encoding="utf-8"?>
2 187 sjacqu01
<xsl:stylesheet
3 187 sjacqu01
                xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0"
4 187 sjacqu01
                xmlns="http://www.w3.org/1999/XSL/Format"
5 187 sjacqu01
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
6 187 sjacqu01
                xmlns:rng="http://relaxng.org/ns/structure/1.0"
7 187 sjacqu01
                xmlns:tei="http://www.tei-c.org/ns/1.0"
8 187 sjacqu01
                xmlns:teix="http://www.tei-c.org/ns/Examples"
9 187 sjacqu01
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 187 sjacqu01
                exclude-result-prefixes="a rng tei teix xs"
11 187 sjacqu01
                version="2.0">
12 187 sjacqu01
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl" scope="stylesheet" type="stylesheet">
13 187 sjacqu01
      <desc>
14 187 sjacqu01
         <p>
15 187 sjacqu01
    TEI stylesheet
16 187 sjacqu01
    dealing  with elements from the
17 187 sjacqu01
      linking module, making XSL-FO output.
18 187 sjacqu01
      </p>
19 187 sjacqu01
         <p>This software is dual-licensed:
20 187 sjacqu01
21 187 sjacqu01
1. Distributed under a Creative Commons Attribution-ShareAlike 3.0
22 187 sjacqu01
Unported License http://creativecommons.org/licenses/by-sa/3.0/
23 187 sjacqu01
24 187 sjacqu01
2. http://www.opensource.org/licenses/BSD-2-Clause
25 187 sjacqu01
26 187 sjacqu01
All rights reserved.
27 187 sjacqu01
28 187 sjacqu01
Redistribution and use in source and binary forms, with or without
29 187 sjacqu01
modification, are permitted provided that the following conditions are
30 187 sjacqu01
met:
31 187 sjacqu01
32 187 sjacqu01
* Redistributions of source code must retain the above copyright
33 187 sjacqu01
notice, this list of conditions and the following disclaimer.
34 187 sjacqu01
35 187 sjacqu01
* Redistributions in binary form must reproduce the above copyright
36 187 sjacqu01
notice, this list of conditions and the following disclaimer in the
37 187 sjacqu01
documentation and/or other materials provided with the distribution.
38 187 sjacqu01
39 187 sjacqu01
This software is provided by the copyright holders and contributors
40 187 sjacqu01
"as is" and any express or implied warranties, including, but not
41 187 sjacqu01
limited to, the implied warranties of merchantability and fitness for
42 187 sjacqu01
a particular purpose are disclaimed. In no event shall the copyright
43 187 sjacqu01
holder or contributors be liable for any direct, indirect, incidental,
44 187 sjacqu01
special, exemplary, or consequential damages (including, but not
45 187 sjacqu01
limited to, procurement of substitute goods or services; loss of use,
46 187 sjacqu01
data, or profits; or business interruption) however caused and on any
47 187 sjacqu01
theory of liability, whether in contract, strict liability, or tort
48 187 sjacqu01
(including negligence or otherwise) arising in any way out of the use
49 187 sjacqu01
of this software, even if advised of the possibility of such damage.
50 187 sjacqu01
</p>
51 187 sjacqu01
         <p>Author: See AUTHORS</p>
52 187 sjacqu01
         <p>Id: $Id: linking.xsl 9646 2011-11-05 23:39:08Z rahtz $</p>
53 187 sjacqu01
         <p>Copyright: 2011, TEI Consortium</p>
54 187 sjacqu01
      </desc>
55 187 sjacqu01
   </doc>
56 187 sjacqu01
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
57 187 sjacqu01
      <desc>[fo] <param name="where">target of link</param>
58 187 sjacqu01
      </desc>
59 187 sjacqu01
   </doc>
60 187 sjacqu01
  <xsl:template name="generateEndLink">
61 187 sjacqu01
      <xsl:param name="where"/>
62 187 sjacqu01
      <xsl:value-of select="$where"/>
63 187 sjacqu01
  </xsl:template>
64 187 sjacqu01
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
65 187 sjacqu01
      <desc>[fo] <param name="ptr">whether the destination URL is also the body
66 187 sjacqu01
    of the link</param>
67 187 sjacqu01
         <param name="dest">destination URL</param>
68 187 sjacqu01
      </desc>
69 187 sjacqu01
   </doc>
70 187 sjacqu01
  <xsl:template name="makeExternalLink">
71 187 sjacqu01
      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
72 187 sjacqu01
      <xsl:param name="dest"/>
73 187 sjacqu01
      <basic-link external-destination="url({$dest})">
74 187 sjacqu01
         <xsl:choose>
75 187 sjacqu01
            <xsl:when test="$ptr">
76 187 sjacqu01
               <xsl:call-template name="showXrefURL">
77 187 sjacqu01
                  <xsl:with-param name="dest">
78 187 sjacqu01
                     <xsl:value-of select="$dest"/>
79 187 sjacqu01
                  </xsl:with-param>
80 187 sjacqu01
               </xsl:call-template>
81 187 sjacqu01
            </xsl:when>
82 187 sjacqu01
            <xsl:otherwise>
83 187 sjacqu01
               <xsl:apply-templates/>
84 187 sjacqu01
            </xsl:otherwise>
85 187 sjacqu01
         </xsl:choose>
86 187 sjacqu01
      </basic-link>
87 187 sjacqu01
  </xsl:template>
88 187 sjacqu01
  <doc xmlns="http://www.oxygenxml.com/ns/doc/xsl">
89 187 sjacqu01
      <desc>[fo] <param name="ptr">ptr</param>
90 187 sjacqu01
         <param name="target">target</param>
91 187 sjacqu01
         <param name="dest">destination</param>
92 187 sjacqu01
         <param name="body">body</param>
93 187 sjacqu01
      </desc>
94 187 sjacqu01
   </doc>
95 187 sjacqu01
  <xsl:template name="makeInternalLink">
96 187 sjacqu01
      <xsl:param name="ptr" as="xs:boolean" select="false()"/>
97 187 sjacqu01
      <xsl:param name="class"/>
98 187 sjacqu01
      <xsl:param name="target"/>
99 187 sjacqu01
      <xsl:param name="dest"/>
100 187 sjacqu01
      <xsl:param name="body"/>
101 187 sjacqu01
      <xsl:variable name="W">
102 187 sjacqu01
         <xsl:choose>
103 187 sjacqu01
            <xsl:when test="$target">
104 187 sjacqu01
               <xsl:value-of select="$target"/>
105 187 sjacqu01
            </xsl:when>
106 187 sjacqu01
            <xsl:when test="contains($dest,'#')">
107 187 sjacqu01
               <xsl:value-of select="substring($dest,2)"/>
108 187 sjacqu01
            </xsl:when>
109 187 sjacqu01
            <xsl:otherwise>
110 187 sjacqu01
               <xsl:value-of select="$dest"/>
111 187 sjacqu01
            </xsl:otherwise>
112 187 sjacqu01
         </xsl:choose>
113 187 sjacqu01
      </xsl:variable>
114 187 sjacqu01
      <basic-link internal-destination="{$W}">
115 187 sjacqu01
         <xsl:call-template name="linkStyle"/>
116 187 sjacqu01
         <xsl:choose>
117 187 sjacqu01
            <xsl:when test="not($body='')">
118 187 sjacqu01
               <xsl:value-of select="$body"/>
119 187 sjacqu01
            </xsl:when>
120 187 sjacqu01
            <xsl:when test="$ptr">
121 187 sjacqu01
               <xsl:apply-templates mode="xref" select="id($W)">
122 187 sjacqu01
                  <xsl:with-param name="minimal" select="$minimalCrossRef"/>
123 187 sjacqu01
               </xsl:apply-templates>
124 187 sjacqu01
            </xsl:when>
125 187 sjacqu01
            <xsl:otherwise>
126 187 sjacqu01
               <xsl:apply-templates/>
127 187 sjacqu01
            </xsl:otherwise>
128 187 sjacqu01
         </xsl:choose>
129 187 sjacqu01
      </basic-link>
130 187 sjacqu01
  </xsl:template>
131 187 sjacqu01
</xsl:stylesheet>