1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:e="http://explain.z3950.org/dtd/2.0/"
5 <xsl:output method="text" encoding="UTF-8"/>
7 <!-- disable all default text node output -->
8 <xsl:template match="text()"/>
10 <!-- match zeerex xml record -->
11 <xsl:template match="e:explain">
13 # Propeties file to drive org.z3950.zing.cql.CQLNode's toPQF()
14 # back-end and the YAZ CQL-to-PQF converter. This specifies the
15 # interpretation of various CQL indexes, relations, etc. in terms
16 # of Type-1 query attributes.
18 # This file is created from a valid ZeeRex Explain XML record using the
19 # XSLT transformation 'explain2cqlpqftxt.xsl'
21 # xsltproc explain2cqlpqf.xsl explain.xml
23 <xsl:text> </xsl:text>
24 <xsl:text> </xsl:text>
25 <xsl:apply-templates/>
27 <xsl:call-template name="static-text"/>
31 <xsl:template match="e:databaseInfo">
32 <xsl:text># Title: </xsl:text><xsl:value-of select="e:title"/>
33 <xsl:text> </xsl:text>
34 <xsl:text> </xsl:text>
38 <xsl:template match="e:indexInfo">
39 <xsl:variable name="set-default">
40 <xsl:value-of select="../e:configInfo/e:default[@type='contextSet']"/>
43 <xsl:text># Set info</xsl:text>
44 <xsl:text> </xsl:text>
46 <xsl:if test="$set-default">
47 <xsl:text># Default set</xsl:text>
48 <xsl:text> </xsl:text>
49 <xsl:text>set = </xsl:text>
50 <xsl:value-of select="e:set[@name = $set-default]/@identifier"/>
51 <xsl:text> </xsl:text>
52 <xsl:text> </xsl:text>
55 <xsl:for-each select="e:set">
57 <xsl:text># </xsl:text>
58 <xsl:value-of select="e:title"/>
59 <xsl:text> </xsl:text>
61 <xsl:text>set.</xsl:text><xsl:value-of select="@name"/>
62 <xsl:text> = </xsl:text><xsl:value-of select="@identifier"/>
63 <xsl:text> </xsl:text>
65 <xsl:text> </xsl:text>
67 <xsl:text># Index info</xsl:text>
68 <xsl:text> </xsl:text>
69 <xsl:for-each select="e:index">
71 <xsl:text># </xsl:text><xsl:value-of select="e:title"/>
72 <xsl:text> </xsl:text>
74 <xsl:text>index.</xsl:text>
75 <xsl:value-of select="e:map/e:name/@set"/>
76 <xsl:text>.</xsl:text>
77 <xsl:value-of select="e:map/e:name/text()"/>
78 <xsl:text> = </xsl:text>
79 <xsl:for-each select="e:map/e:attr">
80 <xsl:value-of select="@type"/>
81 <xsl:text>=</xsl:text>
82 <xsl:value-of select="text()"/>
83 <xsl:text> </xsl:text>
85 <xsl:text> </xsl:text>
87 <xsl:text> </xsl:text>
90 <xsl:template match="e:configInfo">
91 <xsl:text># Relation info</xsl:text>
92 <xsl:text> </xsl:text>
93 <xsl:for-each select="e:supports[@type='relation']">
95 <xsl:when test="text()='<'">
96 <xsl:text>relation.< = 2=1</xsl:text>
97 <xsl:text> </xsl:text>
99 <xsl:when test="text()='le'">
100 <xsl:text>relation.le = 2=2</xsl:text>
101 <xsl:text> </xsl:text>
103 <xsl:when test="text()='='">
104 <xsl:text>relation.eq = 2=3</xsl:text>
105 <xsl:text> </xsl:text>
107 <xsl:when test="text()='eq'">
108 <xsl:text>relation.eq = 2=3</xsl:text>
109 <xsl:text> </xsl:text>
111 <xsl:when test="text()='exact'">
112 <xsl:text>relation.exact = 2=3</xsl:text>
113 <xsl:text> </xsl:text>
115 <xsl:when test="text()='ge'">
116 <xsl:text>relation.ge = 2=4</xsl:text>
117 <xsl:text> </xsl:text>
119 <xsl:when test="text()='>'">
120 <xsl:text>relation.> = 2=5</xsl:text>
121 <xsl:text> </xsl:text>
123 <xsl:when test="text()='<>'">
124 <xsl:text>relation.<> = 2=6</xsl:text>
125 <xsl:text> </xsl:text>
127 <xsl:when test="text()='all'">
128 <xsl:text>relation.all = 2=3</xsl:text>
129 <xsl:text> </xsl:text>
131 <xsl:when test="text()='any'">
132 <xsl:text>relation.any = 2=3</xsl:text>
133 <xsl:text> </xsl:text>
137 <xsl:text> </xsl:text>
138 <xsl:text> </xsl:text>
140 <xsl:text># Default Relation</xsl:text>
141 <xsl:text> </xsl:text>
142 <xsl:text>relation.scr = 2=3</xsl:text>
143 <xsl:text> </xsl:text>
144 <xsl:text> </xsl:text>
146 <xsl:text># RelationModifier info</xsl:text>
147 <xsl:text> </xsl:text>
148 <xsl:for-each select="e:supports[@type='relationModifier']">
150 <xsl:when test="text()='relevant'">
151 <xsl:text>relationModifier.relevant = 2=102 </xsl:text>
152 <xsl:text> </xsl:text>
154 <xsl:when test="text()='fuzzy'">
155 <xsl:text>relationModifier.fuzzy = 2=100 </xsl:text>
156 <xsl:text> </xsl:text>
158 <xsl:when test="text()='stem'">
159 <xsl:text>relationModifier.stem = 2=101 </xsl:text>
160 <xsl:text> </xsl:text>
162 <xsl:when test="text()='phonetic'">
163 <xsl:text>relationModifier.phonetic = 2=100 </xsl:text>
164 <xsl:text> </xsl:text>
166 <xsl:when test="text()='phrase'">
167 <xsl:text>relationModifier.phrase = 6=3 </xsl:text>
168 <xsl:text> </xsl:text>
175 <xsl:template name="static-text">
178 # Position attributes
179 position.first = 3=1 6=1
180 position.any = 3=3 6=1
181 position.last = 3=4 6=1
182 position.firstAndLast = 3=3 6=3
184 # Structure attributes may be specified for individual relations; a
185 # default structure attribute my be specified by the pseudo-relation
186 # "*", to be used whenever a relation not listed here occurs.
188 structure.exact = 4=108
194 # Truncation attributes used to implement CQL wildcard patterns. The
195 # simpler forms, left, right- and both-truncation will be used for the
196 # simplest patterns, so that we produce PQF queries that conform more
197 # closely to the Bath Profile. However, when a more complex pattern
198 # such as "foo*bar" is used, we fall back on Z39.58-style masking.
200 truncation.right = 5=1
201 truncation.left = 5=2
202 truncation.both = 5=3
203 truncation.none = 5=100
204 truncation.z3958 = 5=104
206 # Finally, any additional attributes that should always be included
207 # with each term can be specified in the "always" property.
210 # 6=1: completeness = incomplete subfield