comparison xslt/link.xslt @ 170:cd2698ea00ab

Added generated XSLTs.
author Ruslan Ermilov <ru@nginx.com>
date Wed, 02 Nov 2011 19:31:11 +0000
parents
children e179a6487bbd
comparison
equal deleted inserted replaced
169:b7b160e4e046 170:cd2698ea00ab
1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
4 <xsl:template match="a[starts-with(@href, '/') and string() = '' and contains(@href, '.xml')]">
5
6 <a>
7
8 <xsl:attribute name="href">
9 <xsl:choose>
10
11 <xsl:when test="starts-with(@href, $DIRNAME)">
12
13 <xsl:value-of select=" substring-after(document(concat($XML, @href))/article/@link |document(concat($XML, @href))/module/@link, $DIRNAME)"/>
14 </xsl:when>
15
16 <xsl:otherwise>
17
18 <xsl:value-of select=" concat($ROOT, document(concat($XML, @href))/article/@link |document(concat($XML, @href))/module/@link)"/>
19 </xsl:otherwise>
20 </xsl:choose>
21 </xsl:attribute>
22
23 <xsl:value-of select=" document(concat($XML, @href))/article/@name |document(concat($XML, @href))/module/@name"/>
24
25 </a>
26 </xsl:template>
27
28 <xsl:template match="a[starts-with(@href, '/') and string() and contains(@href, '.xml')]">
29
30 <a>
31
32 <xsl:attribute name="href">
33 <xsl:choose>
34
35 <xsl:when test="starts-with(@href, $DIRNAME)">
36
37 <xsl:value-of select=" substring-after(document(concat($XML, @href))/article/@link |document(concat($XML, @href))/module/@link, $DIRNAME)"/>
38 </xsl:when>
39
40 <xsl:otherwise>
41
42 <xsl:value-of select=" concat($ROOT, document(concat($XML, @href))/article/@link |document(concat($XML, @href))/module/@link)"/>
43 </xsl:otherwise>
44 </xsl:choose>
45 </xsl:attribute>
46
47 <xsl:apply-templates/>
48
49 </a>
50 </xsl:template>
51
52 <xsl:template match="a">
53 <a href="{@href}">
54 <xsl:apply-templates/>
55 </a>
56 </xsl:template>
57
58 <xsl:template match="img">
59 <img src="{@href}">
60 <xsl:apply-templates/>
61 </img>
62 </xsl:template>
63
64 <xsl:template match="link[@url]">
65 <a href="{@url}">
66 <xsl:apply-templates/>
67 </a>
68 </xsl:template>
69
70 <xsl:template match="link[@id and not(@doc)]">
71
72 <a href="#{@id}">
73 <xsl:choose>
74
75 <xsl:when test="count(node()) != 0">
76 <xsl:apply-templates/>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:value-of select="@id"/>
80 </xsl:otherwise>
81 </xsl:choose>
82
83 </a>
84 </xsl:template>
85
86 <xsl:template match="link[@doc and not(@id)]">
87
88 <a href="{substring-before(@doc, '.xml')}.html">
89 <xsl:apply-templates/>
90 </a>
91 </xsl:template>
92
93 <xsl:template match="link[@id and @doc]">
94
95 <a href="{substring-before(@doc, '.xml')}.html#{@id}">
96 <xsl:choose>
97
98 <xsl:when test="count(node()) != 0">
99 <xsl:apply-templates/>
100 </xsl:when>
101 <xsl:otherwise>
102 <xsl:value-of select="@id"/>
103 </xsl:otherwise>
104 </xsl:choose>
105
106 </a>
107 </xsl:template>
108
109 </xsl:stylesheet>