1
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
3
This program is free software; you can redistribute it and/or modify it under
4
the terms of the GNU Lesser General Public License as published by the Free
5
Software Foundation; either version 2 of the License, or (at your option) any
8
This program is distributed in the hope that it will be useful, but WITHOUT
9
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
You should have received a copy of the GNU Lesser General Public License
14
along with this program; see the file COPYING.LGPL. If not, write to the
15
Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
20
xmlns:mal='http://projectmallard.org/1.0/'
21
xmlns:cache='http://projectmallard.org/cache/1.0/'
22
xmlns='http://projectmallard.org/1.0/'
25
<!--!!==========================================================================
27
Generate Mallard cache files from cache input files.
32
<xsl:output omit-xml-declaration="yes"/>
34
<xsl:include href="../common/mal-link.xsl"/>
37
<!--**==========================================================================
40
<xsl:template name="mal.cache.id">
41
<xsl:param name="node" select="."/>
42
<xsl:param name="node_in"/>
43
<xsl:attribute name="id">
44
<xsl:call-template name="mal.link.linkid">
45
<xsl:with-param name="node" select="$node"/>
51
<!--**==========================================================================
54
<xsl:template name="mal.cache.xref">
55
<xsl:param name="node" select="."/>
56
<xsl:param name="node_in"/>
57
<xsl:attribute name="xref">
58
<xsl:value-of select="$node/@xref"/>
63
<!--**==========================================================================
66
<xsl:template name="mal.cache.groups">
67
<xsl:param name="node" select="."/>
68
<xsl:param name="node_in"/>
69
<xsl:attribute name="groups">
70
<xsl:value-of select="$node/@groups"/>
71
<xsl:if test="not(contains(concat(' ', $node/@groups, ' '), ' #default '))">
72
<xsl:text> #default</xsl:text>
78
<!--**==========================================================================
81
<xsl:template name="mal.cache.info">
82
<xsl:param name="node" select="."/>
83
<xsl:param name="info" select="$node/mal:info"/>
84
<xsl:param name="node_in"/>
86
<xsl:if test="not($info/mal:title[@type = 'link'])">
88
<xsl:copy-of select="$node/mal:title/node()"/>
91
<xsl:if test="not($info/mal:title[@type = 'sort'])">
94
<xsl:when test="$info/mal:title[@type = 'link']">
95
<xsl:copy-of select="$info/mal:title[@type = 'link'][1]/node()"/>
98
<xsl:copy-of select="$node/mal:title/node()"/>
103
<xsl:for-each select="$info/*">
105
<xsl:when test="self::mal:link">
107
<xsl:call-template name="mal.cache.xref">
108
<xsl:with-param name="node_in" select="$node_in"/>
110
<xsl:if test="@type = 'guide' and not(@weight)">
111
<xsl:attribute name="weight">
112
<xsl:text>0</xsl:text>
115
<xsl:for-each select="attribute::*[not(name(.) = 'xref')] | *">
116
<xsl:copy-of select="."/>
121
<xsl:copy-of select="."/>
129
<!-- == Matched Templates == -->
131
<!-- = /cache:cache = -->
132
<xsl:template match='/cache:cache'>
134
<xsl:for-each select="mal:page">
135
<xsl:apply-templates select="document(@cache:href)/*">
136
<xsl:with-param name="node_in" select="."/>
137
</xsl:apply-templates>
142
<!-- = mal:page = -->
143
<xsl:template match="mal:page">
144
<xsl:param name="node_in"/>
145
<page cache:href="{$node_in/@cache:href}">
146
<xsl:call-template name="mal.cache.id">
147
<xsl:with-param name="node_in" select="$node_in"/>
149
<xsl:call-template name="mal.cache.groups">
150
<xsl:with-param name="node_in" select="$node_in"/>
152
<xsl:if test="@type">
153
<xsl:attribute name="type">
154
<xsl:value-of select="@type"/>
157
<xsl:call-template name="mal.cache.info">
158
<xsl:with-param name="node_in" select="$node_in"/>
160
<xsl:apply-templates>
161
<xsl:with-param name="node_in" select="$node_in"/>
162
</xsl:apply-templates>
166
<!-- = mal:section = -->
167
<xsl:template match="mal:section">
168
<xsl:param name="node_in"/>
170
<xsl:call-template name="mal.cache.id">
171
<xsl:with-param name="node_in" select="$node_in"/>
173
<xsl:call-template name="mal.cache.groups">
174
<xsl:with-param name="node_in" select="$node_in"/>
176
<xsl:call-template name="mal.cache.info">
177
<xsl:with-param name="node_in" select="$node_in"/>
179
<xsl:apply-templates>
180
<xsl:with-param name="node_in" select="$node_in"/>
181
</xsl:apply-templates>
185
<!-- = mal:title = -->
186
<xsl:template match="mal:title">
187
<xsl:copy-of select="."/>
190
<xsl:template match="node() | text()"/>