1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2 xmlns:e="http://explain.z3950.org/dtd/2.0/"
4 <!-- $Id: explain2cqlpqftxt.xsl,v 1.1 2006-11-29 11:28:18 marc Exp $ -->
6 <xsl:output method="text" encoding="UTF-8"/>
8 <!-- disable all default text node output -->
9 <xsl:template match="text()"/>
11 <!-- match zeerex xml record -->
12 <xsl:template match="e:explain">
14 # Propeties file to drive org.z3950.zing.cql.CQLNode's toPQF()
15 # back-end and the YAZ CQL-to-PQF converter. This specifies the
16 # interpretation of various CQL indexes, relations, etc. in terms
17 # of Type-1 query attributes.
19 # This file is created from a valid ZeeRex Explain XML record using the
20 # XSLT transformation 'explain2cqlpqftxt.xsl'
22 # xsltproc explain2cqlpqf.xsl explain.xml
24 <xsl:text> </xsl:text>
25 <xsl:text> </xsl:text>
26 <xsl:apply-templates/>
28 <xsl:call-template name="static-text"/>
32 <xsl:template match="e:databaseInfo">
33 <xsl:text># Title: </xsl:text><xsl:value-of select="e:title"/>
34 <xsl:text> </xsl:text>
35 <xsl:text> </xsl:text>
39 <xsl:template match="e:indexInfo">
40 <xsl:variable name="set-default">
41 <xsl:value-of select="../e:configInfo/e:default[@type='contextSet']"/>
44 <xsl:text># Set info</xsl:text>
45 <xsl:text> </xsl:text>
47 <xsl:if test="$set-default">
48 <xsl:text># Default set</xsl:text>
49 <xsl:text> </xsl:text>
50 <xsl:text>set = </xsl:text>
51 <xsl:value-of select="e:set[@name = $set-default]/@identifier"/>
52 <xsl:text> </xsl:text>
53 <xsl:text> </xsl:text>
56 <xsl:for-each select="e:set">
58 <xsl:text># </xsl:text>
59 <xsl:value-of select="e:title"/>
60 <xsl:text> </xsl:text>
62 <xsl:text>set.</xsl:text><xsl:value-of select="@name"/>
63 <xsl:text> = </xsl:text><xsl:value-of select="@identifier"/>
64 <xsl:text> </xsl:text>
66 <xsl:text> </xsl:text>
68 <xsl:text># Index info</xsl:text>
69 <xsl:text> </xsl:text>
70 <xsl:for-each select="e:index">
72 <xsl:text># </xsl:text><xsl:value-of select="e:title"/>
73 <xsl:text> </xsl:text>
75 <xsl:text>index.</xsl:text>
76 <xsl:value-of select="e:map/e:name/@set"/>
77 <xsl:text>.</xsl:text>
78 <xsl:value-of select="e:map/e:name/text()"/>
79 <xsl:text> = </xsl:text>
80 <xsl:for-each select="e:map/e:attr">
81 <xsl:value-of select="@type"/>
82 <xsl:text>=</xsl:text>
83 <xsl:value-of select="text()"/>
84 <xsl:text> </xsl:text>
86 <xsl:text> </xsl:text>
88 <xsl:text> </xsl:text>
91 <xsl:template match="e:configInfo">
92 <xsl:text># Relation info</xsl:text>
93 <xsl:text> </xsl:text>
94 <xsl:for-each select="e:supports[@type='relation']">
96 <xsl:when test="text()='<'">
97 <xsl:text>relation.< = 2=1</xsl:text>
98 <xsl:text> </xsl:text>
100 <xsl:when test="text()='le'">
101 <xsl:text>relation.le = 2=2</xsl:text>
102 <xsl:text> </xsl:text>
104 <xsl:when test="text()='='">
105 <xsl:text>relation.eq = 2=3</xsl:text>
106 <xsl:text> </xsl:text>
108 <xsl:when test="text()='eq'">
109 <xsl:text>relation.eq = 2=3</xsl:text>
110 <xsl:text> </xsl:text>
112 <xsl:when test="text()='exact'">
113 <xsl:text>relation.exact = 2=3</xsl:text>
114 <xsl:text> </xsl:text>
116 <xsl:when test="text()='ge'">
117 <xsl:text>relation.ge = 2=4</xsl:text>
118 <xsl:text> </xsl:text>
120 <xsl:when test="text()='>'">
121 <xsl:text>relation.> = 2=5</xsl:text>
122 <xsl:text> </xsl:text>
124 <xsl:when test="text()='<>'">
125 <xsl:text>relation.<> = 2=6</xsl:text>
126 <xsl:text> </xsl:text>
128 <xsl:when test="text()='all'">
129 <xsl:text>relation.all = 2=3</xsl:text>
130 <xsl:text> </xsl:text>
132 <xsl:when test="text()='any'">
133 <xsl:text>relation.any = 2=3</xsl:text>
134 <xsl:text> </xsl:text>
138 <xsl:text> </xsl:text>
139 <xsl:text> </xsl:text>
141 <xsl:text># Default Relation</xsl:text>
142 <xsl:text> </xsl:text>
143 <xsl:text>relation.scr = 2=3</xsl:text>
144 <xsl:text> </xsl:text>
145 <xsl:text> </xsl:text>
147 <xsl:text># RelationModifier info</xsl:text>
148 <xsl:text> </xsl:text>
149 <xsl:for-each select="e:supports[@type='relationModifier']">
151 <xsl:when test="text()='relevant'">
152 <xsl:text>relationModifier.relevant = 2=102 </xsl:text>
153 <xsl:text> </xsl:text>
155 <xsl:when test="text()='fuzzy'">
156 <xsl:text>relationModifier.fuzzy = 2=100 </xsl:text>
157 <xsl:text> </xsl:text>
159 <xsl:when test="text()='stem'">
160 <xsl:text>relationModifier.stem = 2=101 </xsl:text>
161 <xsl:text> </xsl:text>
163 <xsl:when test="text()='phonetic'">
164 <xsl:text>relationModifier.phonetic = 2=100 </xsl:text>
165 <xsl:text> </xsl:text>
167 <xsl:when test="text()='phrase'">
168 <xsl:text>relationModifier.phrase = 6=3 </xsl:text>
169 <xsl:text> </xsl:text>
176 <xsl:template name="static-text">
179 # Position attributes
180 position.first = 3=1 6=1
181 position.any = 3=3 6=1
182 position.last = 3=4 6=1
183 position.firstAndLast = 3=3 6=3
185 # Structure attributes may be specified for individual relations; a
186 # default structure attribute my be specified by the pseudo-relation
187 # "*", to be used whenever a relation not listed here occurs.
189 structure.exact = 4=108
195 # Truncation attributes used to implement CQL wildcard patterns. The
196 # simpler forms, left, right- and both-truncation will be used for the
197 # simplest patterns, so that we produce PQF queries that conform more
198 # closely to the Bath Profile. However, when a more complex pattern
199 # such as "foo*bar" is used, we fall back on Z39.58-style masking.
201 truncation.right = 5=1
202 truncation.left = 5=2
203 truncation.both = 5=3
204 truncation.none = 5=100
205 truncation.z3958 = 5=104
207 # Finally, any additional attributes that should always be included
208 # with each term can be specified in the "always" property.
211 # 6=1: completeness = incomplete subfield