check return value before using key_values
[Samba.git] / docs-xml / xslt / html-common.xsl
blob86d31a508ebe51685ca8c9b73fb65b19ece327dc
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:xlink='http://www.w3.org/1999/xlink'
4 exclude-result-prefixes="xlink"
5 version="1.0">
7 <xsl:param name="base.dir" select="'../htmldocs/'"/>
8 <xsl:param name="bridgehead.in.toc" select="1"/>
9 <xsl:param name="citerefentry.link" select="'1'"/>
10 <xsl:param name="css.decoration" select="1"/>
11 <xsl:param name="html.stylesheet" select="'../samba.css'"/>
12 <xsl:param name="html.stylesheet.type">text/css</xsl:param>
13 <xsl:param name="use.extensions" select="'0'"/>
14 <xsl:param name="use.id.as.filename" select="'1'"/>
15 <xsl:param name="use.local.olink.style" select="1"/>
16 <xsl:param name="use.role.as.xrefstyle" select="1"/>
17 <xsl:param name="use.role.for.mediaobject" select="1"/>
19 <xsl:template name="generate.citerefentry.link">
20 <xsl:value-of select="refentrytitle"/><xsl:text>.</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>.html</xsl:text>
21 </xsl:template>
23 <xsl:template match="author">
24 </xsl:template>
26 <xsl:template match="link" name="link">
27 <xsl:param name="linkend" select="@linkend"/>
28 <xsl:param name="a.target"/>
29 <xsl:param name="xhref" select="@xlink:href"/>
31 <xsl:variable name="content">
32 <xsl:call-template name="anchor"/>
33 <xsl:choose>
34 <xsl:when test="count(child::node()) &gt; 0">
35 <!-- If it has content, use it -->
36 <xsl:apply-templates/>
37 </xsl:when>
38 <!-- else look for an endterm -->
39 <xsl:when test="@endterm">
40 <xsl:variable name="etargets" select="key('id',@endterm)"/>
41 <xsl:variable name="etarget" select="$etargets[1]"/>
42 <xsl:choose>
43 <xsl:when test="count($etarget) = 0">
44 <xsl:message>
45 <xsl:value-of select="count($etargets)"/>
46 <xsl:text>Endterm points to nonexistent ID: </xsl:text>
47 <xsl:value-of select="@endterm"/>
48 </xsl:message>
49 <xsl:text>???</xsl:text>
50 </xsl:when>
51 <xsl:otherwise>
52 <xsl:apply-templates select="$etarget" mode="endterm"/>
53 </xsl:otherwise>
54 </xsl:choose>
55 </xsl:when>
56 <xsl:otherwise>
57 <xsl:choose>
58 <xsl:when test="key('id', @linkend)/title[1]">
59 <xsl:call-template name="gentext.startquote"/>
60 <xsl:value-of select="key('id', @linkend)/title[1]"/>
61 <xsl:call-template name="gentext.endquote"/>
62 </xsl:when>
63 <xsl:otherwise>
64 <xsl:message>
65 <xsl:text>Link element has no content and no Endterm. And linkend's pointer has no title. </xsl:text>
66 <xsl:text>Nothing to show in the link to </xsl:text>
67 <xsl:value-of select="(@linkend)[1]"/>
68 </xsl:message>
69 </xsl:otherwise>
70 </xsl:choose>
71 </xsl:otherwise>
72 </xsl:choose>
73 </xsl:variable>
75 <xsl:call-template name="simple.xlink">
76 <xsl:with-param name="node" select="."/>
77 <xsl:with-param name="linkend" select="$linkend"/>
78 <xsl:with-param name="content" select="$content"/>
79 <xsl:with-param name="a.target" select="$a.target"/>
80 <xsl:with-param name="xhref" select="$xhref"/>
81 </xsl:call-template>
83 </xsl:template>
85 </xsl:stylesheet>