Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / profiling / profile-mode.xsl
bloba0e927e3bd29695074db7dddfa05a30d4b2b01c8
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:saxon="http://icl.com/saxon"
3 exclude-result-prefixes="saxon"
4 version="1.0">
6 <!-- Should be base URI for imagedata and so on fixed? -->
7 <xsl:param name="profile.baseuri.fixup" select="true()"/>
9 <!-- Copy all non-element nodes -->
10 <xsl:template match="@*|text()|comment()|processing-instruction()" mode="profile">
11 <xsl:copy/>
12 </xsl:template>
14 <!-- Profile elements based on input parameters -->
15 <xsl:template match="*" mode="profile">
17 <xsl:variable name="arch.content">
18 <xsl:if test="@arch">
19 <xsl:call-template name="cross.compare">
20 <xsl:with-param name="a" select="$profile.arch"/>
21 <xsl:with-param name="b" select="@arch"/>
22 </xsl:call-template>
23 </xsl:if>
24 </xsl:variable>
25 <xsl:variable name="arch.ok" select="not(@arch) or not($profile.arch) or
26 $arch.content != '' or @arch = ''"/>
28 <xsl:variable name="condition.content">
29 <xsl:if test="@condition">
30 <xsl:call-template name="cross.compare">
31 <xsl:with-param name="a" select="$profile.condition"/>
32 <xsl:with-param name="b" select="@condition"/>
33 </xsl:call-template>
34 </xsl:if>
35 </xsl:variable>
36 <xsl:variable name="condition.ok" select="not(@condition) or not($profile.condition) or
37 $condition.content != '' or @condition = ''"/>
39 <xsl:variable name="conformance.content">
40 <xsl:if test="@conformance">
41 <xsl:call-template name="cross.compare">
42 <xsl:with-param name="a" select="$profile.conformance"/>
43 <xsl:with-param name="b" select="@conformance"/>
44 </xsl:call-template>
45 </xsl:if>
46 </xsl:variable>
47 <xsl:variable name="conformance.ok" select="not(@conformance) or not($profile.conformance) or
48 $conformance.content != '' or @conformance = ''"/>
50 <xsl:variable name="lang.content">
51 <xsl:if test="@lang | @xml:lang">
52 <xsl:call-template name="cross.compare">
53 <xsl:with-param name="a" select="$profile.lang"/>
54 <xsl:with-param name="b" select="(@lang | @xml:lang)[1]"/>
55 </xsl:call-template>
56 </xsl:if>
57 </xsl:variable>
58 <xsl:variable name="lang.ok" select="not(@lang | @xml:lang) or not($profile.lang) or
59 $lang.content != '' or @lang = '' or @xml:lang = ''"/>
61 <xsl:variable name="os.content">
62 <xsl:if test="@os">
63 <xsl:call-template name="cross.compare">
64 <xsl:with-param name="a" select="$profile.os"/>
65 <xsl:with-param name="b" select="@os"/>
66 </xsl:call-template>
67 </xsl:if>
68 </xsl:variable>
69 <xsl:variable name="os.ok" select="not(@os) or not($profile.os) or
70 $os.content != '' or @os = ''"/>
72 <xsl:variable name="revision.content">
73 <xsl:if test="@revision">
74 <xsl:call-template name="cross.compare">
75 <xsl:with-param name="a" select="$profile.revision"/>
76 <xsl:with-param name="b" select="@revision"/>
77 </xsl:call-template>
78 </xsl:if>
79 </xsl:variable>
80 <xsl:variable name="revision.ok" select="not(@revision) or not($profile.revision) or
81 $revision.content != '' or @revision = ''"/>
83 <xsl:variable name="revisionflag.content">
84 <xsl:if test="@revisionflag">
85 <xsl:call-template name="cross.compare">
86 <xsl:with-param name="a" select="$profile.revisionflag"/>
87 <xsl:with-param name="b" select="@revisionflag"/>
88 </xsl:call-template>
89 </xsl:if>
90 </xsl:variable>
91 <xsl:variable name="revisionflag.ok" select="not(@revisionflag) or not($profile.revisionflag) or
92 $revisionflag.content != '' or @revisionflag = ''"/>
94 <xsl:variable name="role.content">
95 <xsl:if test="@role">
96 <xsl:call-template name="cross.compare">
97 <xsl:with-param name="a" select="$profile.role"/>
98 <xsl:with-param name="b" select="@role"/>
99 </xsl:call-template>
100 </xsl:if>
101 </xsl:variable>
102 <xsl:variable name="role.ok" select="not(@role) or not($profile.role) or
103 $role.content != '' or @role = ''"/>
105 <xsl:variable name="security.content">
106 <xsl:if test="@security">
107 <xsl:call-template name="cross.compare">
108 <xsl:with-param name="a" select="$profile.security"/>
109 <xsl:with-param name="b" select="@security"/>
110 </xsl:call-template>
111 </xsl:if>
112 </xsl:variable>
113 <xsl:variable name="security.ok" select="not(@security) or not($profile.security) or
114 $security.content != '' or @security = ''"/>
116 <xsl:variable name="status.content">
117 <xsl:if test="@status">
118 <xsl:call-template name="cross.compare">
119 <xsl:with-param name="a" select="$profile.status"/>
120 <xsl:with-param name="b" select="@status"/>
121 </xsl:call-template>
122 </xsl:if>
123 </xsl:variable>
124 <xsl:variable name="status.ok" select="not(@status) or not($profile.status) or
125 $status.content != '' or @status = ''"/>
127 <xsl:variable name="userlevel.content">
128 <xsl:if test="@userlevel">
129 <xsl:call-template name="cross.compare">
130 <xsl:with-param name="a" select="$profile.userlevel"/>
131 <xsl:with-param name="b" select="@userlevel"/>
132 </xsl:call-template>
133 </xsl:if>
134 </xsl:variable>
135 <xsl:variable name="userlevel.ok" select="not(@userlevel) or not($profile.userlevel) or
136 $userlevel.content != '' or @userlevel = ''"/>
138 <xsl:variable name="vendor.content">
139 <xsl:if test="@vendor">
140 <xsl:call-template name="cross.compare">
141 <xsl:with-param name="a" select="$profile.vendor"/>
142 <xsl:with-param name="b" select="@vendor"/>
143 </xsl:call-template>
144 </xsl:if>
145 </xsl:variable>
146 <xsl:variable name="vendor.ok" select="not(@vendor) or not($profile.vendor) or
147 $vendor.content != '' or @vendor = ''"/>
149 <xsl:variable name="attribute.content">
150 <xsl:if test="@*[local-name()=$profile.attribute]">
151 <xsl:call-template name="cross.compare">
152 <xsl:with-param name="a" select="$profile.value"/>
153 <xsl:with-param name="b" select="@*[local-name()=$profile.attribute]"/>
154 </xsl:call-template>
155 </xsl:if>
156 </xsl:variable>
157 <xsl:variable name="attribute.ok"
158 select="not(@*[local-name()=$profile.attribute]) or not($profile.value) or
159 $attribute.content != '' or
160 @*[local-name()=$profile.attribute] = '' or not($profile.attribute)"/>
162 <xsl:if test="$arch.ok and $condition.ok and $conformance.ok and $lang.ok and $os.ok
163 and $revision.ok and $revisionflag.ok and $role.ok and $security.ok
164 and $status.ok and $userlevel.ok and $vendor.ok and $attribute.ok">
165 <xsl:copy>
166 <xsl:copy-of select="@*"/>
168 <!-- Entity references must be replaced with filereferences for temporary tree -->
169 <xsl:if test="@entityref and $profile.baseuri.fixup">
170 <xsl:attribute name="fileref">
171 <xsl:value-of select="unparsed-entity-uri(@entityref)"/>
172 </xsl:attribute>
173 </xsl:if>
175 <!-- xml:base is eventually added to the root element -->
176 <xsl:if test="not(../..) and $profile.baseuri.fixup">
177 <xsl:call-template name="add-xml-base"/>
178 </xsl:if>
180 <xsl:apply-templates select="node()" mode="profile"/>
181 </xsl:copy>
182 </xsl:if>
183 </xsl:template>
185 <!-- Returns non-empty string if list in $b contains one ore more values from list $a -->
186 <xsl:template name="cross.compare">
187 <xsl:param name="a"/>
188 <xsl:param name="b"/>
189 <xsl:param name="sep" select="$profile.separator"/>
190 <xsl:variable name="head" select="substring-before(concat($a, $sep), $sep)"/>
191 <xsl:variable name="tail" select="substring-after($a, $sep)"/>
192 <xsl:if test="contains(concat($sep, $b, $sep), concat($sep, $head, $sep))">1</xsl:if>
193 <xsl:if test="$tail">
194 <xsl:call-template name="cross.compare">
195 <xsl:with-param name="a" select="$tail"/>
196 <xsl:with-param name="b" select="$b"/>
197 </xsl:call-template>
198 </xsl:if>
199 </xsl:template>
201 </xsl:stylesheet>