1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
4 <!-- Copy all non-element nodes -->
\r
5 <xsl:template match="@*|text()|comment()|processing-instruction()" mode="profile">
\r
9 <!-- Profile elements based on input parameters -->
\r
10 <xsl:template match="*" mode="profile">
\r
12 <xsl:variable name="arch.content">
\r
13 <xsl:if test="@arch">
\r
14 <xsl:call-template name="cross.compare">
\r
15 <xsl:with-param name="a" select="$profile.arch"/>
\r
16 <xsl:with-param name="b" select="@arch"/>
\r
17 </xsl:call-template>
\r
20 <xsl:variable name="arch.ok" select="not(@arch) or not($profile.arch) or
\r
21 $arch.content != '' or @arch = ''"/>
\r
23 <xsl:variable name="condition.content">
\r
24 <xsl:if test="@condition">
\r
25 <xsl:call-template name="cross.compare">
\r
26 <xsl:with-param name="a" select="$profile.condition"/>
\r
27 <xsl:with-param name="b" select="@condition"/>
\r
28 </xsl:call-template>
\r
31 <xsl:variable name="condition.ok" select="not(@condition) or not($profile.condition) or
\r
32 $condition.content != '' or @condition = ''"/>
\r
34 <xsl:variable name="conformance.content">
\r
35 <xsl:if test="@conformance">
\r
36 <xsl:call-template name="cross.compare">
\r
37 <xsl:with-param name="a" select="$profile.conformance"/>
\r
38 <xsl:with-param name="b" select="@conformance"/>
\r
39 </xsl:call-template>
\r
42 <xsl:variable name="conformance.ok" select="not(@conformance) or not($profile.conformance) or
\r
43 $conformance.content != '' or @conformance = ''"/>
\r
45 <xsl:variable name="lang.content">
\r
46 <xsl:if test="@lang">
\r
47 <xsl:call-template name="cross.compare">
\r
48 <xsl:with-param name="a" select="$profile.lang"/>
\r
49 <xsl:with-param name="b" select="@lang"/>
\r
50 </xsl:call-template>
\r
53 <xsl:variable name="lang.ok" select="not(@lang) or not($profile.lang) or
\r
54 $lang.content != '' or @lang = ''"/>
\r
56 <xsl:variable name="os.content">
\r
58 <xsl:call-template name="cross.compare">
\r
59 <xsl:with-param name="a" select="$profile.os"/>
\r
60 <xsl:with-param name="b" select="@os"/>
\r
61 </xsl:call-template>
\r
64 <xsl:variable name="os.ok" select="not(@os) or not($profile.os) or
\r
65 $os.content != '' or @os = ''"/>
\r
67 <xsl:variable name="revision.content">
\r
68 <xsl:if test="@revision">
\r
69 <xsl:call-template name="cross.compare">
\r
70 <xsl:with-param name="a" select="$profile.revision"/>
\r
71 <xsl:with-param name="b" select="@revision"/>
\r
72 </xsl:call-template>
\r
75 <xsl:variable name="revision.ok" select="not(@revision) or not($profile.revision) or
\r
76 $revision.content != '' or @revision = ''"/>
\r
78 <xsl:variable name="revisionflag.content">
\r
79 <xsl:if test="@revisionflag">
\r
80 <xsl:call-template name="cross.compare">
\r
81 <xsl:with-param name="a" select="$profile.revisionflag"/>
\r
82 <xsl:with-param name="b" select="@revisionflag"/>
\r
83 </xsl:call-template>
\r
86 <xsl:variable name="revisionflag.ok" select="not(@revisionflag) or not($profile.revisionflag) or
\r
87 $revisionflag.content != '' or @revisionflag = ''"/>
\r
89 <xsl:variable name="role.content">
\r
90 <xsl:if test="@role">
\r
91 <xsl:call-template name="cross.compare">
\r
92 <xsl:with-param name="a" select="$profile.role"/>
\r
93 <xsl:with-param name="b" select="@role"/>
\r
94 </xsl:call-template>
\r
97 <xsl:variable name="role.ok" select="not(@role) or not($profile.role) or
\r
98 $role.content != '' or @role = ''"/>
\r
100 <xsl:variable name="security.content">
\r
101 <xsl:if test="@security">
\r
102 <xsl:call-template name="cross.compare">
\r
103 <xsl:with-param name="a" select="$profile.security"/>
\r
104 <xsl:with-param name="b" select="@security"/>
\r
105 </xsl:call-template>
\r
108 <xsl:variable name="security.ok" select="not(@security) or not($profile.security) or
\r
109 $security.content != '' or @security = ''"/>
\r
111 <xsl:variable name="userlevel.content">
\r
112 <xsl:if test="@userlevel">
\r
113 <xsl:call-template name="cross.compare">
\r
114 <xsl:with-param name="a" select="$profile.userlevel"/>
\r
115 <xsl:with-param name="b" select="@userlevel"/>
\r
116 </xsl:call-template>
\r
119 <xsl:variable name="userlevel.ok" select="not(@userlevel) or not($profile.userlevel) or
\r
120 $userlevel.content != '' or @userlevel = ''"/>
\r
122 <xsl:variable name="vendor.content">
\r
123 <xsl:if test="@vendor">
\r
124 <xsl:call-template name="cross.compare">
\r
125 <xsl:with-param name="a" select="$profile.vendor"/>
\r
126 <xsl:with-param name="b" select="@vendor"/>
\r
127 </xsl:call-template>
\r
130 <xsl:variable name="vendor.ok" select="not(@vendor) or not($profile.vendor) or
\r
131 $vendor.content != '' or @vendor = ''"/>
\r
133 <xsl:variable name="attribute.content">
\r
134 <xsl:if test="@*[local-name()=$profile.attribute]">
\r
135 <xsl:call-template name="cross.compare">
\r
136 <xsl:with-param name="a" select="$profile.value"/>
\r
137 <xsl:with-param name="b" select="@*[local-name()=$profile.attribute]"/>
\r
138 </xsl:call-template>
\r
141 <xsl:variable name="attribute.ok"
\r
142 select="not(@*[local-name()=$profile.attribute]) or not($profile.value) or
\r
143 $attribute.content != '' or
\r
144 @*[local-name()=$profile.attribute] = '' or not($profile.attribute)"/>
\r
146 <xsl:if test="$arch.ok and $condition.ok and $conformance.ok and $lang.ok and $os.ok
\r
147 and $revision.ok and $revisionflag.ok and $role.ok and $security.ok
\r
148 and $userlevel.ok and $vendor.ok and $attribute.ok">
\r
150 <xsl:apply-templates select="@*|node()" mode="profile"/>
\r
155 <!-- Returns non-empty string if list in $b contains one ore more values from list $a -->
\r
156 <xsl:template name="cross.compare">
\r
157 <xsl:param name="a"/>
\r
158 <xsl:param name="b"/>
\r
159 <xsl:param name="sep" select="$profile.separator"/>
\r
160 <xsl:variable name="head" select="substring-before(concat($a, $sep), $sep)"/>
\r
161 <xsl:variable name="tail" select="substring-after($a, $sep)"/>
\r
162 <xsl:if test="contains(concat($sep, $b, $sep), concat($sep, $head, $sep))">1</xsl:if>
\r
163 <xsl:if test="$tail">
\r
164 <xsl:call-template name="cross.compare">
\r
165 <xsl:with-param name="a" select="$tail"/>
\r
166 <xsl:with-param name="b" select="$b"/>
\r
167 </xsl:call-template>
\r