Project

Profile

Help

How to connect?
Download (3.68 KB) Statistics
| Branch: | Revision:

he / tools / make-menu_change-links.xsl @ 01d6fdb6

1
<?xml version="1.0" encoding="UTF-8"?>
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
4
    exclude-result-prefixes="xs"
5
    version="2.0">
6
       
7
    <xsl:import href="make-menu.xsl"/>
8
    
9
    <xsl:variable name="homepage" select="'../welcome/welcome.html'"/>    
10
    
11
    <xsl:template match="/">
12
        <xsl:apply-imports />
13
    </xsl:template>
14
    
15
    <xsl:template match="a">
16
        <xsl:copy>            
17
            <xsl:apply-templates select="@*,node()"/>            
18
        </xsl:copy>
19
    </xsl:template>
20
    
21
    <xsl:template match="@*">
22
        <xsl:copy> 
23
        
24
        </xsl:copy>
25
    </xsl:template>
26
    
27
    <xsl:template match="@href">
28
        <xsl:choose>
29
            <xsl:when test="contains(.,'user-doc/1.1/index.html')">
30
                <xsl:attribute name="href" select="parent::a/@id" />
31
            </xsl:when>
32
            <xsl:when test="contains(.,'saxon-js/documentation/index.html')">
33
                <xsl:attribute name="href" select="." />
34
            </xsl:when>
35
           <xsl:when test="contains(.,'saxon-c/documentation/index.html')">
36
              <xsl:attribute name="href" select="." />
37
           </xsl:when>
38
            <xsl:when test="contains(.,'xqts100/results100-88.xml') or contains(.,'xslts1.0.4/published-results8.8.xml')
39
                or contains(.,'http://www.xml') or contains(.,'.xml.') or contains(.,'shop.html#!') or contains(.,'.xmlprague')">
40
                <xsl:attribute name="href" select="." />
41
            </xsl:when>
42
            <xsl:otherwise>
43
                <xsl:variable name="extension">
44
                    <xsl:if test="count(tokenize(tokenize(.,'#!')[2],'/')) gt 1 and not(contains(parent::a/@class,'has-subpages'))">
45
                        <xsl:value-of select="'.html'"/>
46
                    </xsl:if>
47
                    <xsl:if test="count(tokenize(tokenize(.,'#!')[2],'/')) eq 1 or contains(parent::a/@class,'has-subpages')">
48
                        <xsl:value-of select="'/index.html'"/>
49
                    </xsl:if>
50
                </xsl:variable>
51
                <xsl:choose>
52
                    <xsl:when test="contains(.,'index.html#!')">
53
                        <xsl:attribute name="href" select="concat(replace(., 'index.html#!', ''), $extension)" />
54
                    </xsl:when>
55
                    <xsl:when test="contains(.,'documentation9.5/#!')">
56
                        <xsl:attribute name="href" select="concat(replace(., 'documentation9.5/#!', '../documentation9.5/'), $extension)" />
57
                    </xsl:when>
58
                    <xsl:when test="contains(.,'/#!')">
59
                        <xsl:attribute name="href" select="concat(replace(., '/#!', '/'), $extension)" />
60
                    </xsl:when>
61
                    <xsl:when test="contains(.,'#!')">
62
                        <xsl:attribute name="href" select="concat(replace(., '#!', '/'), $extension)" />
63
                    </xsl:when>
64
                    <xsl:otherwise>
65
                        <xsl:attribute name="href" select="replace(., '\.xml', '.html')" />
66
                    </xsl:otherwise>
67
                </xsl:choose>
68
            </xsl:otherwise>
69
        </xsl:choose>        
70
    </xsl:template>    
71
    
72
    <xsl:template mode="menu-area" match="*">
73
        <xsl:next-match>
74
            <xsl:with-param name="extension" select="'html'"></xsl:with-param>
75
        </xsl:next-match>
76
    </xsl:template>
77
    
78
    <xsl:template match="div[@id='sitemap']">
79
        <xsl:next-match>
80
            <xsl:with-param name="extension" select="'html'"></xsl:with-param>
81
        </xsl:next-match>
82
    </xsl:template>
83
            
84
</xsl:stylesheet>
(14-14/15)