| 1 |
<?xml version='1.0'?> |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
<!DOCTYPE xsl:transform [ |
| 8 |
|
| 9 |
<!ENTITY bullet "•"> |
| 10 |
]> |
| 11 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 12 |
xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0"> |
| 13 |
|
| 14 |
<xsl:template match="*[contains(@class,' topic/related-links ')]"> |
| 15 |
<xsl:if test="$output-related-links='yes'"> |
| 16 |
<fo:block> |
| 17 |
<fo:block font-weight="bold"> |
| 18 |
<xsl:text>Related Links</xsl:text> |
| 19 |
</fo:block> |
| 20 |
<fo:block> |
| 21 |
<xsl:attribute name="start-indent"> |
| 22 |
<xsl:value-of select="$basic-start-indent"/> |
| 23 |
</xsl:attribute> |
| 24 |
<xsl:apply-templates/> |
| 25 |
</fo:block> |
| 26 |
</fo:block> |
| 27 |
</xsl:if> |
| 28 |
</xsl:template> |
| 29 |
<xsl:template |
| 30 |
match="*[contains(@class,' topic/linklist ')]/*[contains(@class,' topic/title ')]"> |
| 31 |
<fo:block font-weight="bold"> |
| 32 |
<xsl:apply-templates/> |
| 33 |
</fo:block> |
| 34 |
</xsl:template> |
| 35 |
<xsl:template match="*[contains(@class,' topic/linklist ')]"> |
| 36 |
<fo:block> |
| 37 |
<xsl:apply-templates/> |
| 38 |
</fo:block> |
| 39 |
</xsl:template> |
| 40 |
<xsl:template match="*[contains(@class,' topic/linkpool ')]"> |
| 41 |
<fo:block> |
| 42 |
<xsl:apply-templates/> |
| 43 |
</fo:block> |
| 44 |
</xsl:template> |
| 45 |
<xsl:template match="*[contains(@class,' topic/linktext ')]"> |
| 46 |
<fo:inline> |
| 47 |
<xsl:apply-templates/> |
| 48 |
</fo:inline> |
| 49 |
</xsl:template> |
| 50 |
|
| 51 |
<xsl:template match="*[contains(@class,' topic/link ')][@href = '']"> |
| 52 |
<fo:block color="red" |
| 53 |
start-indent="{$basic-start-indent}"> |
| 54 |
<xsl:text>• </xsl:text> |
| 55 |
<xsl:apply-templates/> |
| 56 |
</fo:block> |
| 57 |
</xsl:template> |
| 58 |
|
| 59 |
<xsl:template match="*[contains(@class,' topic/link ')][not(@href = '')]"> |
| 60 |
<xsl:choose> |
| 61 |
<xsl:when test="not(@scope='external') and (@format='dita' or @format='DITA' or not(@format))"> |
| 62 |
<fo:block color="blue" text-decoration="underline" |
| 63 |
start-indent="{$basic-start-indent}"> |
| 64 |
<xsl:text>• </xsl:text> |
| 65 |
<fo:basic-link> |
| 66 |
<xsl:attribute name="internal-destination"> |
| 67 |
<xsl:call-template name="href"/> |
| 68 |
</xsl:attribute> |
| 69 |
<xsl:apply-templates select="*[contains(@class,' topic/linktext ')]|text()"/> |
| 70 |
|
| 71 |
<xsl:choose> |
| 72 |
<xsl:when test="*[contains(@class, ' topic/linktext ')]"> |
| 73 |
<xsl:apply-templates select="*[contains(@class, ' topic/linktext ')]"/> |
| 74 |
</xsl:when> |
| 75 |
<xsl:otherwise> |
| 76 |
|
| 77 |
<xsl:value-of select="@href"/> |
| 78 |
</xsl:otherwise> |
| 79 |
</xsl:choose> |
| 80 |
</fo:basic-link> |
| 81 |
</fo:block> |
| 82 |
</xsl:when> |
| 83 |
<xsl:otherwise> |
| 84 |
<fo:block color="blue" text-decoration="underline" |
| 85 |
start-indent="{$basic-start-indent}"> |
| 86 |
<xsl:text>• </xsl:text> |
| 87 |
<fo:basic-link> |
| 88 |
<xsl:attribute name="external-destination"> |
| 89 |
<xsl:value-of select="@href"/> |
| 90 |
</xsl:attribute> |
| 91 |
|
| 92 |
<xsl:choose> |
| 93 |
<xsl:when test="*[contains(@class, ' topic/linktext ')]"> |
| 94 |
<xsl:apply-templates select="*[contains(@class, ' topic/linktext ')]"/> |
| 95 |
</xsl:when> |
| 96 |
<xsl:otherwise> |
| 97 |
|
| 98 |
<xsl:value-of select="@href"/> |
| 99 |
</xsl:otherwise> |
| 100 |
</xsl:choose> |
| 101 |
</fo:basic-link> |
| 102 |
</fo:block> |
| 103 |
</xsl:otherwise> |
| 104 |
</xsl:choose> |
| 105 |
</xsl:template> |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
<xsl:template match="*[contains(@class,' topic/xref ')][@href = '']"> |
| 110 |
<fo:inline color="red"> |
| 111 |
<fo:inline font-weight="bold">[xref to: <xsl:value-of |
| 112 |
select="@href"/>]</fo:inline> |
| 113 |
<xsl:apply-templates/> |
| 114 |
</fo:inline> |
| 115 |
</xsl:template> |
| 116 |
|
| 117 |
<xsl:template match="*[contains(@class,' topic/xref ')][not(@href='')]"> |
| 118 |
<xsl:choose> |
| 119 |
|
| 120 |
|
| 121 |
<xsl:when test="not(@scope='external') and (@format='dita' or @format='DITA' or not(@format))"> |
| 122 |
<fo:inline color="blue"> |
| 123 |
<fo:basic-link> |
| 124 |
|
| 125 |
<xsl:attribute name="internal-destination"> |
| 126 |
<xsl:call-template name="href"/> |
| 127 |
</xsl:attribute> |
| 128 |
|
| 129 |
<xsl:choose> |
| 130 |
|
| 131 |
<xsl:when test="text()"> |
| 132 |
<xsl:apply-templates select="text()"/> |
| 133 |
</xsl:when> |
| 134 |
|
| 135 |
<xsl:otherwise> |
| 136 |
<xsl:value-of select="@href"/> |
| 137 |
</xsl:otherwise> |
| 138 |
</xsl:choose> |
| 139 |
</fo:basic-link> |
| 140 |
</fo:inline> |
| 141 |
<fo:inline> |
| 142 |
<xsl:variable name="href-id"> |
| 143 |
<xsl:call-template name="href"/> |
| 144 |
</xsl:variable> |
| 145 |
<xsl:text> on page </xsl:text><fo:page-number-citation ref-id="{$href-id}"/> |
| 146 |
</fo:inline> |
| 147 |
</xsl:when> |
| 148 |
<xsl:otherwise> |
| 149 |
<fo:inline color="blue"> |
| 150 |
<fo:basic-link> |
| 151 |
<xsl:attribute name="external-destination"> |
| 152 |
<xsl:value-of select="@href"/> |
| 153 |
</xsl:attribute> |
| 154 |
|
| 155 |
<xsl:choose> |
| 156 |
|
| 157 |
<xsl:when test="text()"> |
| 158 |
<xsl:apply-templates select="text()"/> |
| 159 |
</xsl:when> |
| 160 |
|
| 161 |
<xsl:otherwise> |
| 162 |
<xsl:value-of select="@href"/> |
| 163 |
</xsl:otherwise> |
| 164 |
</xsl:choose> |
| 165 |
</fo:basic-link> |
| 166 |
</fo:inline> |
| 167 |
</xsl:otherwise> |
| 168 |
</xsl:choose> |
| 169 |
|
| 170 |
</xsl:template> |
| 171 |
|
| 172 |
<xsl:template name="href"> |
| 173 |
<xsl:choose> |
| 174 |
|
| 175 |
<xsl:when test="starts-with(@href,'#')"> |
| 176 |
<xsl:choose> |
| 177 |
<xsl:when test="contains(substring-after(@href,'#'),'/')"> |
| 178 |
<xsl:value-of |
| 179 |
select="substring-before(substring-after(@href,'#'),'/')"/> |
| 180 |
</xsl:when> |
| 181 |
<xsl:otherwise> |
| 182 |
<xsl:value-of select="substring-after(@href,'#')"/> |
| 183 |
</xsl:otherwise> |
| 184 |
</xsl:choose> |
| 185 |
</xsl:when> |
| 186 |
<xsl:when test="contains(@href,'#')"> |
| 187 |
<xsl:value-of select="document(substring-before(@href,'#'),/)//descendant::*[contains(@class,' topic/topic ')][1]/@id"/> |
| 188 |
</xsl:when> |
| 189 |
<xsl:otherwise> |
| 190 |
<xsl:value-of select="document(@href,/)/descendant::*[contains(@class,' topic/topic ')][1]/@id"/> |
| 191 |
</xsl:otherwise> |
| 192 |
</xsl:choose> |
| 193 |
</xsl:template> |
| 194 |
|
| 195 |
</xsl:stylesheet> |