-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlinks.xsl
More file actions
32 lines (29 loc) · 1.04 KB
/
links.xsl
File metadata and controls
32 lines (29 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0"?>
<!-- SPDX-License-Identifier: CC0-1.0 -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://www.forester-notes.org">
<xsl:template match="text()[ancestor::f:link[1]/@href]">
<a href="{ancestor::f:link[1]/@href}">
<xsl:choose>
<xsl:when test="ancestor::f:link[1]/@display-uri">
<xsl:attribute name="title">
<xsl:value-of select="ancestor::f:link[1]/@title" />
<xsl:text> [</xsl:text>
<xsl:value-of select="ancestor::f:link[1]/@display-uri" />
<xsl:text>]</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="title">
<xsl:value-of select="ancestor::f:link[1]/@title" />
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="."/>
</a>
</xsl:template>
<xsl:template match="f:link">
<span class="link {@type}">
<xsl:apply-templates />
</span>
</xsl:template>
</xsl:stylesheet>