3d4dcbccc0758b5cbc5a945653639f19480a08cb
[senf.git] / senfscons / xrefhtml.xslt
1 <?xml version="1.0" encoding="utf-8"?>\r
2 <xsl:stylesheet\r
3   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
4   xmlns:fn="http://senf.berlios.de/xml/Extensions"\r
5   xmlns:exsl="http://exslt.org/common"\r
6   xmlns:str="http://exslt.org/strings"\r
7   extension-element-prefixes="str fn exsl"\r
8   version="1.0">\r
9 \r
10   <xsl:include href="functions.xsl"/>\r
11 \r
12   <xsl:output method="html"/>\r
13   <xsl:strip-space elements="*"/>\r
14   <xsl:param name="title" select="''"/>\r
15 \r
16   <xsl:template match="/">\r
17     <h1><xsl:value-of select="$title"/></h1>\r
18     <xsl:apply-templates/>\r
19   </xsl:template>\r
20 \r
21   <xsl:template match="xreflist">\r
22     <xsl:if test="string(preceding::xreflist[1]/@module)!=string(@module)">\r
23       <xsl:if test="preceding::xreflist">\r
24         <hr/>\r
25       </xsl:if>\r
26       <h2>The <xsl:element name="a">\r
27         <xsl:attribute name="href">../../<xsl:value-of select="@module"/>/doc/html/index.html</xsl:attribute>\r
28         <xsl:value-of select="@module"/>\r
29       </xsl:element> module</h2>\r
30     </xsl:if>\r
31     <xsl:element name="dl">\r
32       <xsl:attribute name="class"><xsl:value-of select="@type"/></xsl:attribute>\r
33       <dt><h3><xsl:value-of select="translate(@type,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> items</h3></dt>\r
34       <xsl:apply-templates/>\r
35     </xsl:element>\r
36   </xsl:template>\r
37 \r
38   <fn:nsquote>\r
39     <fn:replacement>\r
40       <fn:match>_1_1</fn:match>\r
41       <fn:replace>_2</fn:replace>\r
42     </fn:replacement>\r
43   </fn:nsquote>\r
44 \r
45   <xsl:variable name="nsquote" select="document('')//fn:nsquote/fn:replacement"/>\r
46   \r
47   <xsl:template match="compound">\r
48     <!-- Yuck ... I HATE this .. why doesn't xsltproc support XPath 2.0 ... grmpf -->\r
49     <xsl:variable name="quoted">\r
50       <xsl:apply-templates select="str:replace(@id,$nsquote/fn:match,$nsquote/fn:replace)"/>\r
51     </xsl:variable>\r
52     <xsl:variable name="anchor" select="substring-after($quoted,'_1')"/>\r
53     <xsl:variable name="file">\r
54       <xsl:apply-templates select="str:replace(substring($quoted,1,string-length($quoted) - number(boolean($anchor))*2 - string-length($anchor)),$nsquote/fn:replace,$nsquote/fn:match)"/>\r
55     </xsl:variable>\r
56     <xsl:variable name="sep" select="substring('#',2-number(boolean($anchor)))"/>\r
57     <dt>\r
58       <xsl:element name="a">\r
59         <xsl:attribute name="href">../../<xsl:value-of select="ancestor::xreflist/@module"/>/doc/html/<xsl:value-of select="$file"/>.html<xsl:value-of select="$sep"/><xsl:value-of select="$anchor"/></xsl:attribute>\r
60         <b><xsl:value-of select="@name"/></b>\r
61       </xsl:element>\r
62     </dt>\r
63     <dd>\r
64       <xsl:apply-templates/>\r
65     </dd>\r
66   </xsl:template>\r
67 \r
68   <xsl:template match="item">\r
69     <p><xsl:apply-templates/></p>\r
70   </xsl:template>\r
71 \r
72 </xsl:stylesheet>\r