xqueryx-CDATA.xsl.xml - Revision 1.10 | xqueryx-CDATA.xsl.xml - Working Copy (Revision 1.10) | ||
1 | <![CDATA[ | 1 | <![CDATA[ |
2 | <?xml version="1.0"?> | 2 | <?xml version="1.0"?> |
3 | <!-- ================================================================================ --> | 3 | <!-- ================================================================================ --> |
4 | <!-- Changes from Recommendation (XQueryX 3.0): --> | 4 | <!-- Changes from Recommendation (XQueryX 3.0): --> |
5 | <!-- ================================================================================ --> | 5 | <!-- ================================================================================ --> |
6 | <!-- Errata applied: --> | 6 | <!-- Errata applied: --> |
7 | <!-- ================================================================================ --> | 7 | <!-- ================================================================================ --> |
8 | <!-- Modifications: --> | 8 | <!-- Modifications: --> |
9 | <!-- JS/2015-11-05 : Added support for stringConstructor --> | ||
9 | <!-- JM/2014-07-11 : Added support for anyMapText and typedMapTest --> | 10 | <!-- JM/2014-07-11 : Added support for anyMapText and typedMapTest --> |
10 | <!-- JM/2014-07-11 : Added support for anyArrayText and typedArrayTest --> | 11 | <!-- JM/2014-07-11 : Added support for anyArrayText and typedArrayTest --> |
11 | <!-- JM/2014-07-13 : Added support for new alternatives in stepExpr --> | 12 | <!-- JM/2014-07-13 : Added support for new alternatives in stepExpr --> |
12 | <!-- JM/2014-07-13 : Added support for lookup (formerly mapLookup) --> | 13 | <!-- JM/2014-07-13 : Added support for lookup (formerly mapLookup) --> |
13 | <!-- JM/2014-07-13 : Added support for unaryLookup (formerly unaryMapLookup) --> | 14 | <!-- JM/2014-07-13 : Added support for unaryLookup (formerly unaryMapLookup) --> |
14 | <!-- JM/2014-07-13 : Added support for new alternatives in filterExpr --> | 15 | <!-- JM/2014-07-13 : Added support for new alternatives in filterExpr --> |
15 | <!-- JM/2014-07-13 : Added support for mapConstructor and arrayConstructor --> | 16 | <!-- JM/2014-07-13 : Added support for mapConstructor and arrayConstructor --> |
16 | <!-- JM/2014-08-28 : Fixed [unary]Lookup replacing stringLiteral w/integerLiteral --> | 17 | <!-- JM/2014-08-28 : Fixed [unary]Lookup replacing stringLiteral w/integerLiteral --> |
17 | <!-- JM/2015-02-11 : Replaced arrowPostfix with arrowExpr per bug 27537 --> | 18 | <!-- JM/2015-02-11 : Replaced arrowPostfix with arrowExpr per bug 27537 --> |
18 | <!-- ================================================================================ --> | 19 | <!-- ================================================================================ --> |
19 | <xsl:stylesheet version="2.0" | 20 | <xsl:stylesheet version="2.0" |
20 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | 21 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
21 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 22 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
22 | xmlns:xqx="http://www.w3.org/2005/XQueryX"> | 23 | xmlns:xqx="http://www.w3.org/2005/XQueryX"> |
23 | 24 | ||
24 | <!-- Note that this stylesheet frequently invokes templates for | 25 | <!-- Note that this stylesheet frequently invokes templates for |
25 | specified elements, even when there are no templates in the | 26 | specified elements, even when there are no templates in the |
26 | stylesheet whose match="" attribute identifies those elements. | 27 | stylesheet whose match="" attribute identifies those elements. |
27 | In such case, the default template's element matching template | 28 | In such case, the default template's element matching template |
28 | is invoked, which merely invokes xsl:apply-templates --> | 29 | is invoked, which merely invokes xsl:apply-templates --> |
29 | 30 | ||
30 | <xsl:output method="text"/> | 31 | <xsl:output method="text"/> |
31 | <xsl:strip-space elements="*"/> | 32 | <xsl:strip-space elements="*"/> |
32 | <xsl:preserve-space elements="xqx:value xqx:attributeValue xqx:pragmaContents | 33 | <xsl:preserve-space elements="xqx:value xqx:attributeValue xqx:pragmaContents |
33 | xqx:optionContents xqx:xquery"/> | 34 | xqx:optionContents xqx:xquery"/> |
34 | 35 | ||
35 | <xsl:variable name="DOT" select="'.'"/> | 36 | <xsl:variable name="DOT" select="'.'"/> |
36 | <xsl:variable name="SPACE" select="' '"/> | 37 | <xsl:variable name="SPACE" select="' '"/> |
37 | <xsl:variable name="SLASH" select="'/'"/> | 38 | <xsl:variable name="SLASH" select="'/'"/> |
38 | <xsl:variable name="SLASH_SLASH" select="'//'"/> | 39 | <xsl:variable name="SLASH_SLASH" select="'//'"/> |
39 | <xsl:variable name="LESSTHAN" select="'<'"/> | 40 | <xsl:variable name="LESSTHAN" select="'<'"/> |
40 | <xsl:variable name="GREATERTHAN" select="'>'"/> | 41 | <xsl:variable name="GREATERTHAN" select="'>'"/> |
41 | <xsl:variable name="LPAREN" select="'('"/> | 42 | <xsl:variable name="LPAREN" select="'('"/> |
42 | <xsl:variable name="RPAREN" select="')'"/> | 43 | <xsl:variable name="RPAREN" select="')'"/> |
43 | <xsl:variable name="NEWLINE"><xsl:text> | 44 | <xsl:variable name="NEWLINE"><xsl:text> |
44 | </xsl:text></xsl:variable> | 45 | </xsl:text></xsl:variable> |
45 | <xsl:variable name="COMMA" select="','"/> | 46 | <xsl:variable name="COMMA" select="','"/> |
46 | <xsl:variable name="COMMA_SPACE" select="', '"/> | 47 | <xsl:variable name="COMMA_SPACE" select="', '"/> |
47 | <xsl:variable name="COMMA_NEWLINE"><xsl:text>, | 48 | <xsl:variable name="COMMA_NEWLINE"><xsl:text>, |
48 | </xsl:text></xsl:variable> | 49 | </xsl:text></xsl:variable> |
49 | <xsl:variable name="QUOTE"><xsl:text>'</xsl:text></xsl:variable> | 50 | <xsl:variable name="QUOTE"><xsl:text>'</xsl:text></xsl:variable> |
50 | <xsl:variable name="DOUBLEQUOTE"><xsl:text>"</xsl:text></xsl:variable> | 51 | <xsl:variable name="DOUBLEQUOTE"><xsl:text>"</xsl:text></xsl:variable> |
51 | <xsl:variable name="TO" select="' to '"/> | 52 | <xsl:variable name="TO" select="' to '"/> |
52 | <xsl:variable name="LBRACE" select="'{'"/> | 53 | <xsl:variable name="LBRACE" select="'{'"/> |
53 | <xsl:variable name="RBRACE" select="'}'"/> | 54 | <xsl:variable name="RBRACE" select="'}'"/> |
54 | <xsl:variable name="LBRACKET" select="'['"/> | 55 | <xsl:variable name="LBRACKET" select="'['"/> |
55 | <xsl:variable name="RBRACKET" select="']'"/> | 56 | <xsl:variable name="RBRACKET" select="']'"/> |
56 | <xsl:variable name="DOLLAR" select="'$'"/> | 57 | <xsl:variable name="DOLLAR" select="'$'"/> |
57 | <xsl:variable name="MINUS" select="'-'"/> | 58 | <xsl:variable name="MINUS" select="'-'"/> |
58 | <xsl:variable name="PLUS" select="'+'"/> | 59 | <xsl:variable name="PLUS" select="'+'"/> |
59 | <xsl:variable name="EQUAL" select="'='"/> | 60 | <xsl:variable name="EQUAL" select="'='"/> |
60 | <xsl:variable name="COLON" select="':'"/> | 61 | <xsl:variable name="COLON" select="':'"/> |
61 | <xsl:variable name="DOUBLE_COLON" select="'::'"/> | 62 | <xsl:variable name="DOUBLE_COLON" select="'::'"/> |
62 | <xsl:variable name="SEMICOLON" select="';'"/> | 63 | <xsl:variable name="SEMICOLON" select="';'"/> |
63 | <xsl:variable name="AT" select="'@'"/> | 64 | <xsl:variable name="AT" select="'@'"/> |
64 | <xsl:variable name="STAR" select="'*'"/> | 65 | <xsl:variable name="STAR" select="'*'"/> |
65 | <xsl:variable name="QUESTIONMARK" select="'?'"/> | 66 | <xsl:variable name="QUESTIONMARK" select="'?'"/> |
66 | <xsl:variable name="EXCLAMATIONMARK" select="'!'"/> | 67 | <xsl:variable name="EXCLAMATIONMARK" select="'!'"/> |
67 | <xsl:variable name="PERCENT" select="'%'"/> | 68 | <xsl:variable name="PERCENT" select="'%'"/> |
68 | <xsl:variable name="ASSIGN" select="':='"/> | 69 | <xsl:variable name="ASSIGN" select="':='"/> |
69 | <xsl:variable name="SEPARATOR" select="';'"/> | 70 | <xsl:variable name="SEPARATOR" select="';'"/> |
70 | <xsl:variable name="PRAGMA_BEGIN" select="'(# '"/> | 71 | <xsl:variable name="PRAGMA_BEGIN" select="'(# '"/> |
71 | <xsl:variable name="PRAGMA_END" select="' #)'"/> | 72 | <xsl:variable name="PRAGMA_END" select="' #)'"/> |
72 | <xsl:variable name="CONCATENATE" select="'||'"/> | 73 | <xsl:variable name="CONCATENATE" select="'||'"/> |
73 | 74 | ||
74 | 75 | ||
75 | <xsl:template name="delimitedList"> | 76 | <xsl:template name="delimitedList"> |
76 | <xsl:param name="delimiter" /> | 77 | <xsl:param name="delimiter" /> |
77 | <xsl:param name="leftEncloser"/> | 78 | <xsl:param name="leftEncloser"/> |
78 | <xsl:param name="rightEncloser" /> | 79 | <xsl:param name="rightEncloser" /> |
79 | <xsl:param name="selector"/> | 80 | <xsl:param name="selector"/> |
80 | 81 | ||
81 | <xsl:value-of select="$leftEncloser"/> | 82 | <xsl:value-of select="$leftEncloser"/> |
82 | <xsl:for-each select="*"> | 83 | <xsl:for-each select="*"> |
83 | <xsl:apply-templates select="."/> | 84 | <xsl:apply-templates select="."/> |
84 | <xsl:if test="not (position()=last())"> | 85 | <xsl:if test="not (position()=last())"> |
85 | <xsl:value-of select="$delimiter"/> | 86 | <xsl:value-of select="$delimiter"/> |
86 | </xsl:if> | 87 | </xsl:if> |
87 | </xsl:for-each> | 88 | </xsl:for-each> |
88 | <xsl:value-of select="$rightEncloser"/> | 89 | <xsl:value-of select="$rightEncloser"/> |
89 | </xsl:template> | 90 | </xsl:template> |
90 | 91 | ||
91 | 92 | ||
92 | <xsl:template name="parenthesizedList"> | 93 | <xsl:template name="parenthesizedList"> |
93 | <xsl:param name="delimiter" select="$COMMA_SPACE"/> | 94 | <xsl:param name="delimiter" select="$COMMA_SPACE"/> |
94 | <xsl:call-template name="delimitedList"> | 95 | <xsl:call-template name="delimitedList"> |
95 | <xsl:with-param name="delimiter" select="$delimiter" /> | 96 | <xsl:with-param name="delimiter" select="$delimiter" /> |
96 | <xsl:with-param name="leftEncloser" select="$LPAREN"/> | 97 | <xsl:with-param name="leftEncloser" select="$LPAREN"/> |
97 | <xsl:with-param name="rightEncloser" select="$RPAREN"/> | 98 | <xsl:with-param name="rightEncloser" select="$RPAREN"/> |
98 | </xsl:call-template> | 99 | </xsl:call-template> |
99 | </xsl:template> | 100 | </xsl:template> |
100 | 101 | ||
101 | 102 | ||
102 | <xsl:template name="commaSeparatedList"> | 103 | <xsl:template name="commaSeparatedList"> |
103 | <xsl:call-template name="delimitedList"> | 104 | <xsl:call-template name="delimitedList"> |
104 | <xsl:with-param name="delimiter"> | 105 | <xsl:with-param name="delimiter"> |
105 | <xsl:value-of select="$COMMA_SPACE"/> | 106 | <xsl:value-of select="$COMMA_SPACE"/> |
106 | </xsl:with-param> | 107 | </xsl:with-param> |
107 | </xsl:call-template> | 108 | </xsl:call-template> |
108 | </xsl:template> | 109 | </xsl:template> |
109 | 110 | ||
110 | 111 | ||
111 | <xsl:template name="quote"> | 112 | <xsl:template name="quote"> |
112 | <xsl:param name="item"/> | 113 | <xsl:param name="item"/> |
113 | <xsl:value-of select="$DOUBLEQUOTE"/> | 114 | <xsl:value-of select="$DOUBLEQUOTE"/> |
114 | <xsl:call-template name="globalReplace"> | 115 | <xsl:call-template name="globalReplace"> |
115 | <xsl:with-param name="stringToBeFixed"> | 116 | <xsl:with-param name="stringToBeFixed"> |
116 | <xsl:call-template name="globalReplace"> | 117 | <xsl:call-template name="globalReplace"> |
117 | <xsl:with-param name="stringToBeFixed"> | 118 | <xsl:with-param name="stringToBeFixed"> |
118 | <xsl:call-template name="globalReplace"> | 119 | <xsl:call-template name="globalReplace"> |
119 | <xsl:with-param name="stringToBeFixed"> | 120 | <xsl:with-param name="stringToBeFixed"> |
120 | <xsl:call-template name="globalReplace"> | 121 | <xsl:call-template name="globalReplace"> |
121 | <xsl:with-param name="stringToBeFixed"> | 122 | <xsl:with-param name="stringToBeFixed"> |
122 | <xsl:call-template name="globalReplace"> | 123 | <xsl:call-template name="globalReplace"> |
123 | <xsl:with-param name="stringToBeFixed"> | 124 | <xsl:with-param name="stringToBeFixed"> |
124 | <xsl:call-template name="globalReplace"> | 125 | <xsl:call-template name="globalReplace"> |
125 | <xsl:with-param name="stringToBeFixed"> | 126 | <xsl:with-param name="stringToBeFixed"> |
126 | <xsl:value-of select="$item"/> | 127 | <xsl:value-of select="$item"/> |
127 | </xsl:with-param> | 128 | </xsl:with-param> |
128 | <xsl:with-param name="toBeReplaced">&</xsl:with-param> | 129 | <xsl:with-param name="toBeReplaced">&</xsl:with-param> |
129 | <xsl:with-param name="replacement">&amp;</xsl:with-param> | 130 | <xsl:with-param name="replacement">&amp;</xsl:with-param> |
130 | </xsl:call-template> | 131 | </xsl:call-template> |
131 | </xsl:with-param> | 132 | </xsl:with-param> |
132 | <xsl:with-param name="toBeReplaced"><</xsl:with-param> | 133 | <xsl:with-param name="toBeReplaced"><</xsl:with-param> |
133 | <xsl:with-param name="replacement">&lt;</xsl:with-param> | 134 | <xsl:with-param name="replacement">&lt;</xsl:with-param> |
134 | </xsl:call-template> | 135 | </xsl:call-template> |
135 | </xsl:with-param> | 136 | </xsl:with-param> |
136 | <xsl:with-param name="toBeReplaced" select="'…'"/> | 137 | <xsl:with-param name="toBeReplaced" select="'…'"/> |
137 | <xsl:with-param name="replacement">&#x85;</xsl:with-param> | 138 | <xsl:with-param name="replacement">&#x85;</xsl:with-param> |
138 | </xsl:call-template> | 139 | </xsl:call-template> |
139 | </xsl:with-param> | 140 | </xsl:with-param> |
140 | <xsl:with-param name="toBeReplaced" select="'
'"/> | 141 | <xsl:with-param name="toBeReplaced" select="'
'"/> |
141 | <xsl:with-param name="replacement">&#xD;</xsl:with-param> | 142 | <xsl:with-param name="replacement">&#xD;</xsl:with-param> |
142 | </xsl:call-template> | 143 | </xsl:call-template> |
143 | </xsl:with-param> | 144 | </xsl:with-param> |
144 | <xsl:with-param name="toBeReplaced" select="'
'"/> | 145 | <xsl:with-param name="toBeReplaced" select="'
'"/> |
145 | <xsl:with-param name="replacement">&#x2028;</xsl:with-param> | 146 | <xsl:with-param name="replacement">&#x2028;</xsl:with-param> |
146 | </xsl:call-template> | 147 | </xsl:call-template> |
147 | </xsl:with-param> | 148 | </xsl:with-param> |
148 | <xsl:with-param name="toBeReplaced"><xsl:text>"</xsl:text></xsl:with-param> | 149 | <xsl:with-param name="toBeReplaced"><xsl:text>"</xsl:text></xsl:with-param> |
149 | <xsl:with-param name="replacement"><xsl:text>""</xsl:text></xsl:with-param> | 150 | <xsl:with-param name="replacement"><xsl:text>""</xsl:text></xsl:with-param> |
150 | </xsl:call-template> | 151 | </xsl:call-template> |
151 | <xsl:value-of select="$DOUBLEQUOTE"/> | 152 | <xsl:value-of select="$DOUBLEQUOTE"/> |
152 | </xsl:template> | 153 | </xsl:template> |
153 | 154 | ||
154 | 155 | ||
155 | <xsl:template name="globalReplace"> | 156 | <xsl:template name="globalReplace"> |
156 | <xsl:param name="stringToBeFixed"/> | 157 | <xsl:param name="stringToBeFixed"/> |
157 | <xsl:param name="toBeReplaced"/> | 158 | <xsl:param name="toBeReplaced"/> |
158 | <xsl:param name="replacement"/> | 159 | <xsl:param name="replacement"/> |
159 | <xsl:choose> | 160 | <xsl:choose> |
160 | <xsl:when test="contains($stringToBeFixed, $toBeReplaced)"> | 161 | <xsl:when test="contains($stringToBeFixed, $toBeReplaced)"> |
161 | <xsl:value-of select="concat(substring-before($stringToBeFixed, $toBeReplaced), $replacement)"/> | 162 | <xsl:value-of select="concat(substring-before($stringToBeFixed, $toBeReplaced), $replacement)"/> |
162 | <xsl:call-template name="globalReplace"> | 163 | <xsl:call-template name="globalReplace"> |
163 | <xsl:with-param name="stringToBeFixed" select="substring-after($stringToBeFixed, $toBeReplaced)"/> | 164 | <xsl:with-param name="stringToBeFixed" select="substring-after($stringToBeFixed, $toBeReplaced)"/> |
164 | <xsl:with-param name="toBeReplaced" select="$toBeReplaced"/> | 165 | <xsl:with-param name="toBeReplaced" select="$toBeReplaced"/> |
165 | <xsl:with-param name="replacement" select="$replacement"/> | 166 | <xsl:with-param name="replacement" select="$replacement"/> |
166 | </xsl:call-template> | 167 | </xsl:call-template> |
167 | </xsl:when> | 168 | </xsl:when> |
168 | <xsl:otherwise> | 169 | <xsl:otherwise> |
169 | <xsl:value-of select="$stringToBeFixed"/> | 170 | <xsl:value-of select="$stringToBeFixed"/> |
170 | </xsl:otherwise> | 171 | </xsl:otherwise> |
171 | </xsl:choose> | 172 | </xsl:choose> |
172 | </xsl:template> | 173 | </xsl:template> |
173 | 174 | ||
174 | 175 | ||
175 | <xsl:template name="renderQName"> | 176 | <xsl:template name="renderQName"> |
176 | <xsl:if test="@xqx:prefix"> | 177 | <xsl:if test="@xqx:prefix"> |
177 | <xsl:value-of select="@xqx:prefix"/> | 178 | <xsl:value-of select="@xqx:prefix"/> |
178 | <xsl:value-of select="$COLON"/> | 179 | <xsl:value-of select="$COLON"/> |
179 | </xsl:if> | 180 | </xsl:if> |
180 | <xsl:value-of select="."/> | 181 | <xsl:value-of select="."/> |
181 | </xsl:template> | 182 | </xsl:template> |
182 | 183 | ||
183 | 184 | ||
184 | <xsl:template name="renderEQName" | 185 | <xsl:template name="renderEQName" |
185 | match="xqx:QName | xqx:pragmaName | xqx:typeName | xqx:varName | | 186 | match="xqx:QName | xqx:pragmaName | xqx:typeName | xqx:varName | |
186 | xqx:functionName | xqx:optionName | xqx:annotationName | | 187 | xqx:functionName | xqx:optionName | xqx:annotationName | |
187 | xqx:atomicType | xqx:tagName | xqx:name | xqx:decimalFormatName"> | 188 | xqx:atomicType | xqx:tagName | xqx:name | xqx:decimalFormatName"> |
188 | <xsl:choose> | 189 | <xsl:choose> |
189 | <xsl:when test="xqx:tagName/parent::xqx:elementConstructor"> | 190 | <xsl:when test="xqx:tagName/parent::xqx:elementConstructor"> |
190 | <xsl:call-template name="renderQName"/> | 191 | <xsl:call-template name="renderQName"/> |
191 | </xsl:when> | 192 | </xsl:when> |
192 | <xsl:otherwise> | 193 | <xsl:otherwise> |
193 | <xsl:choose> | 194 | <xsl:choose> |
194 | <xsl:when test="@xqx:prefix and @xqx:URI"> | 195 | <xsl:when test="@xqx:prefix and @xqx:URI"> |
195 | <xsl:message terminate="yes">Incorrect XQueryX: Elements of type xqx:EQName must not have both 'prefix' and 'URI' attributes</xsl:message> | 196 | <xsl:message terminate="yes">Incorrect XQueryX: Elements of type xqx:EQName must not have both 'prefix' and 'URI' attributes</xsl:message> |
196 | </xsl:when> | 197 | </xsl:when> |
197 | <xsl:when test="@xqx:prefix"> | 198 | <xsl:when test="@xqx:prefix"> |
198 | <xsl:value-of select="@xqx:prefix"/> | 199 | <xsl:value-of select="@xqx:prefix"/> |
199 | <xsl:value-of select="$COLON"/> | 200 | <xsl:value-of select="$COLON"/> |
200 | <xsl:value-of select="."/> | 201 | <xsl:value-of select="."/> |
201 | </xsl:when> | 202 | </xsl:when> |
202 | <xsl:when test="@xqx:URI"> | 203 | <xsl:when test="@xqx:URI"> |
203 | <xsl:text>Q</xsl:text> | 204 | <xsl:text>Q</xsl:text> |
204 | <xsl:value-of select="$LBRACE"/> | 205 | <xsl:value-of select="$LBRACE"/> |
205 | <xsl:value-of select="@xqx:URI"/> | 206 | <xsl:value-of select="@xqx:URI"/> |
206 | <xsl:value-of select="$RBRACE"/> | 207 | <xsl:value-of select="$RBRACE"/> |
207 | <xsl:value-of select="."/> | 208 | <xsl:value-of select="."/> |
208 | </xsl:when> | 209 | </xsl:when> |
209 | <xsl:otherwise> | 210 | <xsl:otherwise> |
210 | <xsl:value-of select="."/> | 211 | <xsl:value-of select="."/> |
211 | </xsl:otherwise> | 212 | </xsl:otherwise> |
212 | </xsl:choose> | 213 | </xsl:choose> |
213 | </xsl:otherwise> | 214 | </xsl:otherwise> |
214 | </xsl:choose> | 215 | </xsl:choose> |
215 | </xsl:template> | 216 | </xsl:template> |
216 | 217 | ||
217 | 218 | ||
218 | <xsl:template match="xqx:attributeName"> | 219 | <xsl:template match="xqx:attributeName"> |
219 | <xsl:choose> | 220 | <xsl:choose> |
220 | <xsl:when test="@xqx:prefix='xmlns'"> | 221 | <xsl:when test="@xqx:prefix='xmlns'"> |
221 | <xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to have prefix 'xmlns'; use xq x:namespaceDeclaration to declare namespaces</xsl:message> | 222 | <xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to have prefix 'xmlns'; use xq x:namespaceDeclaration to declare namespaces</xsl:message> |
222 | </xsl:when> | 223 | </xsl:when> |
223 | <xsl:when test=". = 'xmlns'"> | 224 | <xsl:when test=". = 'xmlns'"> |
224 | <xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to be 'xmlns'; use xqx:namespa ceDeclaration to declare namespaces</xsl:message> | 225 | <xsl:message terminate="yes">Incorrect XQueryX: Attribute names are not permitted to be 'xmlns'; use xqx:namespa ceDeclaration to declare namespaces</xsl:message> |
225 | </xsl:when> | 226 | </xsl:when> |
226 | <xsl:otherwise> | 227 | <xsl:otherwise> |
227 | <xsl:call-template name="renderQName"/> | 228 | <xsl:call-template name="renderQName"/> |
228 | </xsl:otherwise> | 229 | </xsl:otherwise> |
229 | </xsl:choose> | 230 | </xsl:choose> |
230 | </xsl:template> | 231 | </xsl:template> |
231 | 232 | ||
232 | 233 | ||
233 | <xsl:template match="xqx:NCName"> | 234 | <xsl:template match="xqx:NCName"> |
234 | <xsl:value-of select="."/> | 235 | <xsl:value-of select="."/> |
235 | </xsl:template> | 236 | </xsl:template> |
236 | 237 | ||
237 | 238 | ||
238 | <xsl:template match="xqx:rootExpr"> | 239 | <xsl:template match="xqx:rootExpr"> |
239 | <xsl:value-of select="$SLASH"/> | 240 | <xsl:value-of select="$SLASH"/> |
240 | </xsl:template> | 241 | </xsl:template> |
241 | 242 | ||
242 | 243 | ||
243 | <xsl:template match="xqx:argumentPlaceholder"> | 244 | <xsl:template match="xqx:argumentPlaceholder"> |
244 | <xsl:value-of select="$QUESTIONMARK"/> | 245 | <xsl:value-of select="$QUESTIONMARK"/> |
245 | </xsl:template> | 246 | </xsl:template> |
246 | 247 | ||
247 | 248 | ||
248 | <xsl:template match="xqx:pathExpr/xqx:rootExpr"> | 249 | <xsl:template match="xqx:pathExpr/xqx:rootExpr"> |
249 | <xsl:if test="not(following-sibling::xqx:stepExpr)"> | 250 | <xsl:if test="not(following-sibling::xqx:stepExpr)"> |
250 | <xsl:value-of select="$LPAREN"/> | 251 | <xsl:value-of select="$LPAREN"/> |
251 | </xsl:if> | 252 | </xsl:if> |
252 | <xsl:value-of select="$SPACE"/> | 253 | <xsl:value-of select="$SPACE"/> |
253 | <xsl:value-of select="$SLASH"/> | 254 | <xsl:value-of select="$SLASH"/> |
254 | <xsl:value-of select="$SPACE"/> | 255 | <xsl:value-of select="$SPACE"/> |
255 | <xsl:if test="not(following-sibling::xqx:stepExpr)"> | 256 | <xsl:if test="not(following-sibling::xqx:stepExpr)"> |
256 | <xsl:value-of select="$RPAREN"/> | 257 | <xsl:value-of select="$RPAREN"/> |
257 | </xsl:if> | 258 | </xsl:if> |
258 | </xsl:template> | 259 | </xsl:template> |
259 | 260 | ||
260 | 261 | ||
261 | <xsl:template match="xqx:contextItemExpr"> | 262 | <xsl:template match="xqx:contextItemExpr"> |
262 | <xsl:value-of select="$DOT"/> | 263 | <xsl:value-of select="$DOT"/> |
263 | </xsl:template> | 264 | </xsl:template> |
264 | 265 | ||
265 | 266 | ||
266 | <xsl:template match="xqx:stringConstantExpr | xqx:stringLiteral"> | 267 | <xsl:template match="xqx:stringConstantExpr | xqx:stringLiteral"> |
267 | <xsl:call-template name="quote"> | 268 | <xsl:call-template name="quote"> |
268 | <xsl:with-param name="item" select="xqx:value"/> | 269 | <xsl:with-param name="item" select="xqx:value"/> |
269 | </xsl:call-template> | 270 | </xsl:call-template> |
270 | </xsl:template> | 271 | </xsl:template> |
271 | 272 | ||
272 | 273 | ||
273 | ]]><phrase diff="chg" at="2014-07-14"><![CDATA[<!-- 2014-08-28/JM Added integerLiteral for use in lookup (formerly mapLo okup) --> | 274 | ]]><phrase diff="chg" at="2014-07-14"><![CDATA[<!-- 2014-08-28/JM Added integerLiteral for use in lookup (formerly mapLo okup) --> |
274 | <xsl:template match="xqx:integerConstantExpr | | 275 | <xsl:template match="xqx:integerConstantExpr | |
275 | xqx:integerLiteral | | 276 | xqx:integerLiteral | |
276 | ]]></phrase><![CDATA[ xqx:decimalConstantExpr | | 277 | ]]></phrase><![CDATA[ xqx:decimalConstantExpr | |
277 | xqx:doubleConstantExpr"> | 278 | xqx:doubleConstantExpr"> |
278 | <xsl:value-of select="xqx:value"/> | 279 | <xsl:value-of select="xqx:value"/> |
279 | </xsl:template> | 280 | </xsl:template> |
280 | 281 | ||
281 | 282 | ||
282 | ]]><phrase diff="chg" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Added variiableRef for use in arrowExpr --> | 283 | ]]><phrase diff="chg" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Added variiableRef for use in arrowExpr --> |
283 | <xsl:template match="xqx:varRef | xqx:variableRef"> | 284 | <xsl:template match="xqx:varRef | xqx:variableRef"> |
284 | ]]></phrase><![CDATA[ <xsl:value-of select="$DOLLAR"/> | 285 | ]]></phrase><![CDATA[ <xsl:value-of select="$DOLLAR"/> |
285 | <xsl:apply-templates select="xqx:name"/> | 286 | <xsl:apply-templates select="xqx:name"/> |
286 | </xsl:template> | 287 | </xsl:template> |
287 | 288 | ||
288 | 289 | ||
289 | <xsl:template match="xqx:pragma"> | 290 | <xsl:template match="xqx:pragma"> |
290 | <xsl:value-of select="$PRAGMA_BEGIN"/> | 291 | <xsl:value-of select="$PRAGMA_BEGIN"/> |
291 | <xsl:apply-templates select="xqx:pragmaName"/> | 292 | <xsl:apply-templates select="xqx:pragmaName"/> |
292 | <xsl:value-of select="$SPACE"/> | 293 | <xsl:value-of select="$SPACE"/> |
293 | <xsl:value-of select="xqx:pragmaContents"/> | 294 | <xsl:value-of select="xqx:pragmaContents"/> |
294 | <xsl:value-of select="$PRAGMA_END"/> | 295 | <xsl:value-of select="$PRAGMA_END"/> |
295 | </xsl:template> | 296 | </xsl:template> |
296 | 297 | ||
297 | 298 | ||
298 | <xsl:template match="xqx:extensionExpr"> | 299 | <xsl:template match="xqx:extensionExpr"> |
299 | <xsl:apply-templates select="xqx:pragma"/> | 300 | <xsl:apply-templates select="xqx:pragma"/> |
300 | <xsl:value-of select="$LBRACE"/> | 301 | <xsl:value-of select="$LBRACE"/> |
301 | <xsl:apply-templates select="xqx:argExpr"/> | 302 | <xsl:apply-templates select="xqx:argExpr"/> |
302 | <xsl:value-of select="$RBRACE"/> | 303 | <xsl:value-of select="$RBRACE"/> |
303 | </xsl:template> | 304 | </xsl:template> |
304 | 305 | ||
305 | <xsl:template match="xqx:simpleMapExpr"> | 306 | <xsl:template match="xqx:simpleMapExpr"> |
306 | <xsl:value-of select="$LPAREN"/> | 307 | <xsl:value-of select="$LPAREN"/> |
307 | <xsl:value-of select="$SPACE"/> | 308 | <xsl:value-of select="$SPACE"/> |
308 | <xsl:apply-templates select="xqx:pathExpr[1]"/> | 309 | <xsl:apply-templates select="xqx:pathExpr[1]"/> |
309 | <xsl:value-of select="$SPACE"/> | 310 | <xsl:value-of select="$SPACE"/> |
310 | <xsl:value-of select="$RPAREN"/> | 311 | <xsl:value-of select="$RPAREN"/> |
311 | <xsl:for-each select="xqx:pathExpr[position() != 1]"> | 312 | <xsl:for-each select="xqx:pathExpr[position() != 1]"> |
312 | <xsl:value-of select="$NEWLINE"/> | 313 | <xsl:value-of select="$NEWLINE"/> |
313 | <xsl:value-of select="$EXCLAMATIONMARK"/> | 314 | <xsl:value-of select="$EXCLAMATIONMARK"/> |
314 | <xsl:value-of select="$SPACE"/> | 315 | <xsl:value-of select="$SPACE"/> |
315 | <xsl:value-of select="$LPAREN"/> | 316 | <xsl:value-of select="$LPAREN"/> |
316 | <xsl:value-of select="$SPACE"/> | 317 | <xsl:value-of select="$SPACE"/> |
317 | <xsl:apply-templates select="."/> | 318 | <xsl:apply-templates select="."/> |
318 | <xsl:value-of select="$SPACE"/> | 319 | <xsl:value-of select="$SPACE"/> |
319 | <xsl:value-of select="$RPAREN"/> | 320 | <xsl:value-of select="$RPAREN"/> |
320 | </xsl:for-each> | 321 | </xsl:for-each> |
321 | </xsl:template> | 322 | </xsl:template> |
322 | 323 | ||
323 | 324 | ||
324 | <xsl:template match="xqx:functionCallExpr"> | 325 | <xsl:template match="xqx:functionCallExpr"> |
325 | <xsl:if test="(xqx:functionName = 'node' or | 326 | <xsl:if test="(xqx:functionName = 'node' or |
326 | xqx:functionName = 'document-node' or | 327 | xqx:functionName = 'document-node' or |
327 | xqx:functionName = 'element' or | 328 | xqx:functionName = 'element' or |
328 | xqx:functionName = 'attribute' or | 329 | xqx:functionName = 'attribute' or |
329 | xqx:functionName = 'schema-element' or | 330 | xqx:functionName = 'schema-element' or |
330 | xqx:functionName = 'schema-attribute' or | 331 | xqx:functionName = 'schema-attribute' or |
331 | xqx:functionName = 'processing-instruction' or | 332 | xqx:functionName = 'processing-instruction' or |
332 | xqx:functionName = 'comment' or | 333 | xqx:functionName = 'comment' or |
333 | xqx:functionName = 'text' or | 334 | xqx:functionName = 'text' or |
334 | xqx:functionName = 'function' or | 335 | xqx:functionName = 'function' or |
335 | xqx:functionName = 'namespace-node' or | 336 | xqx:functionName = 'namespace-node' or |
336 | xqx:functionName = 'item' or | 337 | xqx:functionName = 'item' or |
337 | xqx:functionName = 'if' or | 338 | xqx:functionName = 'if' or |
338 | xqx:functionName = 'switch' or | 339 | xqx:functionName = 'switch' or |
339 | xqx:functionName = 'typeswitch' or | 340 | xqx:functionName = 'typeswitch' or |
340 | xqx:functionName = 'empty-sequence') and | 341 | xqx:functionName = 'empty-sequence') and |
341 | ((not(xqx:functionName/@xqx:prefix) and not(xqx:functionName/@xqx:URI)) or | 342 | ((not(xqx:functionName/@xqx:prefix) and not(xqx:functionName/@xqx:URI)) or |
342 | xqx:functionName/@xqx:prefix = '' or | 343 | xqx:functionName/@xqx:prefix = '' or |
343 | xqx:functionName/@xqx:URI = '')"> | 344 | xqx:functionName/@xqx:URI = '')"> |
344 | <xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable> | 345 | <xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable> |
345 | <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message> | 346 | <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message> |
346 | </xsl:if> | 347 | </xsl:if> |
347 | <xsl:apply-templates select="xqx:functionName"/> | 348 | <xsl:apply-templates select="xqx:functionName"/> |
348 | <xsl:choose> | 349 | <xsl:choose> |
349 | <xsl:when test="xqx:arguments"> | 350 | <xsl:when test="xqx:arguments"> |
350 | <xsl:for-each select="xqx:arguments"> | 351 | <xsl:for-each select="xqx:arguments"> |
351 | <xsl:call-template name="parenthesizedList"/> | 352 | <xsl:call-template name="parenthesizedList"/> |
352 | </xsl:for-each> | 353 | </xsl:for-each> |
353 | </xsl:when> | 354 | </xsl:when> |
354 | <xsl:otherwise> | 355 | <xsl:otherwise> |
355 | <xsl:value-of select="$LPAREN"/> | 356 | <xsl:value-of select="$LPAREN"/> |
356 | <xsl:value-of select="$RPAREN"/> | 357 | <xsl:value-of select="$RPAREN"/> |
357 | </xsl:otherwise> | 358 | </xsl:otherwise> |
358 | </xsl:choose> | 359 | </xsl:choose> |
359 | </xsl:template> | 360 | </xsl:template> |
360 | 361 | ||
361 | 362 | ||
362 | <xsl:template match="xqx:constructorFunctionExpr"> | 363 | <xsl:template match="xqx:constructorFunctionExpr"> |
363 | <xsl:apply-templates select="xqx:typeName"/> | 364 | <xsl:apply-templates select="xqx:typeName"/> |
364 | <xsl:for-each select="xqx:argExpr"> | 365 | <xsl:for-each select="xqx:argExpr"> |
365 | <xsl:call-template name="parenthesizedList"/> | 366 | <xsl:call-template name="parenthesizedList"/> |
366 | </xsl:for-each> | 367 | </xsl:for-each> |
367 | </xsl:template> | 368 | </xsl:template> |
368 | 369 | ||
369 | 370 | ||
370 | <xsl:template match="xqx:unaryMinusOp | xqx:unaryPlusOp"> | 371 | <xsl:template match="xqx:unaryMinusOp | xqx:unaryPlusOp"> |
371 | <xsl:value-of select="$LPAREN"/> | 372 | <xsl:value-of select="$LPAREN"/> |
372 | <xsl:choose> | 373 | <xsl:choose> |
373 | <xsl:when test="self::xqx:unaryPlusOp"><xsl:value-of select="$PLUS"/></xsl:when> | 374 | <xsl:when test="self::xqx:unaryPlusOp"><xsl:value-of select="$PLUS"/></xsl:when> |
374 | <xsl:when test="self::xqx:unaryMinusOp"><xsl:value-of select="$MINUS"/></xsl:when> | 375 | <xsl:when test="self::xqx:unaryMinusOp"><xsl:value-of select="$MINUS"/></xsl:when> |
375 | </xsl:choose> | 376 | </xsl:choose> |
376 | <xsl:apply-templates select="xqx:operand"/> | 377 | <xsl:apply-templates select="xqx:operand"/> |
377 | <xsl:value-of select="$RPAREN"/> | 378 | <xsl:value-of select="$RPAREN"/> |
378 | </xsl:template> | 379 | </xsl:template> |
379 | 380 | ||
380 | 381 | ||
381 | <xsl:template match="xqx:addOp | xqx:subtractOp | xqx:multiplyOp | 382 | <xsl:template match="xqx:addOp | xqx:subtractOp | xqx:multiplyOp |
382 | | xqx:divOp | xqx:idivOp | xqx:modOp"> | 383 | | xqx:divOp | xqx:idivOp | xqx:modOp"> |
383 | <xsl:value-of select="$LPAREN"/> | 384 | <xsl:value-of select="$LPAREN"/> |
384 | <xsl:apply-templates select="xqx:firstOperand"/> | 385 | <xsl:apply-templates select="xqx:firstOperand"/> |
385 | <xsl:choose> | 386 | <xsl:choose> |
386 | <xsl:when test="self::xqx:addOp"><xsl:value-of select="$PLUS"/></xsl:when> | 387 | <xsl:when test="self::xqx:addOp"><xsl:value-of select="$PLUS"/></xsl:when> |
387 | <xsl:when test="self::xqx:subtractOp"><xsl:text> </xsl:text><xsl:value-of select="$MINUS"/><xsl:text> </xsl:text> </xsl:when> | 388 | <xsl:when test="self::xqx:subtractOp"><xsl:text> </xsl:text><xsl:value-of select="$MINUS"/><xsl:text> </xsl:text> </xsl:when> |
388 | <xsl:when test="self::xqx:multiplyOp"><xsl:value-of select="$STAR"/></xsl:when> | 389 | <xsl:when test="self::xqx:multiplyOp"><xsl:value-of select="$STAR"/></xsl:when> |
389 | <xsl:when test="self::xqx:divOp"><xsl:text> div </xsl:text></xsl:when> | 390 | <xsl:when test="self::xqx:divOp"><xsl:text> div </xsl:text></xsl:when> |
390 | <xsl:when test="self::xqx:idivOp"><xsl:text> idiv </xsl:text></xsl:when> | 391 | <xsl:when test="self::xqx:idivOp"><xsl:text> idiv </xsl:text></xsl:when> |
391 | <xsl:when test="self::xqx:modOp"><xsl:text> mod </xsl:text></xsl:when> | 392 | <xsl:when test="self::xqx:modOp"><xsl:text> mod </xsl:text></xsl:when> |
392 | </xsl:choose> | 393 | </xsl:choose> |
393 | <xsl:apply-templates select="xqx:secondOperand"/> | 394 | <xsl:apply-templates select="xqx:secondOperand"/> |
394 | <xsl:value-of select="$RPAREN"/> | 395 | <xsl:value-of select="$RPAREN"/> |
395 | </xsl:template> | 396 | </xsl:template> |
396 | 397 | ||
397 | 398 | ||
398 | <xsl:template match="xqx:stringConcatenateOp"> | 399 | <xsl:template match="xqx:stringConcatenateOp"> |
399 | <xsl:value-of select="$LPAREN"/> | 400 | <xsl:value-of select="$LPAREN"/> |
400 | <xsl:apply-templates select="xqx:firstOperand"/> | 401 | <xsl:apply-templates select="xqx:firstOperand"/> |
401 | <xsl:value-of select="$CONCATENATE"/> | 402 | <xsl:value-of select="$CONCATENATE"/> |
402 | <xsl:apply-templates select="xqx:secondOperand"/> | 403 | <xsl:apply-templates select="xqx:secondOperand"/> |
403 | <xsl:value-of select="$RPAREN"/> | 404 | <xsl:value-of select="$RPAREN"/> |
404 | </xsl:template> | 405 | </xsl:template> |
405 | 406 | ||
406 | 407 | ||
407 | <xsl:template match="xqx:eqOp | xqx:neOp | xqx:ltOp | 408 | <xsl:template match="xqx:eqOp | xqx:neOp | xqx:ltOp |
408 | | xqx:gtOp | xqx:leOp | xqx:geOp"> | 409 | | xqx:gtOp | xqx:leOp | xqx:geOp"> |
409 | <xsl:value-of select="$LPAREN"/> | 410 | <xsl:value-of select="$LPAREN"/> |
410 | <xsl:apply-templates select="xqx:firstOperand"/> | 411 | <xsl:apply-templates select="xqx:firstOperand"/> |
411 | <xsl:choose> | 412 | <xsl:choose> |
412 | <xsl:when test="self::xqx:eqOp"><xsl:text> eq </xsl:text></xsl:when> | 413 | <xsl:when test="self::xqx:eqOp"><xsl:text> eq </xsl:text></xsl:when> |
413 | <xsl:when test="self::xqx:neOp"><xsl:text> ne </xsl:text></xsl:when> | 414 | <xsl:when test="self::xqx:neOp"><xsl:text> ne </xsl:text></xsl:when> |
414 | <xsl:when test="self::xqx:ltOp"><xsl:text> lt </xsl:text></xsl:when> | 415 | <xsl:when test="self::xqx:ltOp"><xsl:text> lt </xsl:text></xsl:when> |
415 | <xsl:when test="self::xqx:gtOp"><xsl:text> gt </xsl:text></xsl:when> | 416 | <xsl:when test="self::xqx:gtOp"><xsl:text> gt </xsl:text></xsl:when> |
416 | <xsl:when test="self::xqx:leOp"><xsl:text> le </xsl:text></xsl:when> | 417 | <xsl:when test="self::xqx:leOp"><xsl:text> le </xsl:text></xsl:when> |
417 | <xsl:when test="self::xqx:geOp"><xsl:text> ge </xsl:text></xsl:when> | 418 | <xsl:when test="self::xqx:geOp"><xsl:text> ge </xsl:text></xsl:when> |
418 | </xsl:choose> | 419 | </xsl:choose> |
419 | <xsl:apply-templates select="xqx:secondOperand"/> | 420 | <xsl:apply-templates select="xqx:secondOperand"/> |
420 | <xsl:value-of select="$RPAREN"/> | 421 | <xsl:value-of select="$RPAREN"/> |
421 | </xsl:template> | 422 | </xsl:template> |
422 | 423 | ||
423 | 424 | ||
424 | <xsl:template match="xqx:equalOp | xqx:notEqualOp | xqx:lessThanOp | 425 | <xsl:template match="xqx:equalOp | xqx:notEqualOp | xqx:lessThanOp |
425 | | xqx:greaterThanOp | xqx:lessThanOrEqualOp | xqx:greaterThanOrEqualOp"> | 426 | | xqx:greaterThanOp | xqx:lessThanOrEqualOp | xqx:greaterThanOrEqualOp"> |
426 | <xsl:value-of select="$LPAREN"/> | 427 | <xsl:value-of select="$LPAREN"/> |
427 | <xsl:apply-templates select="xqx:firstOperand"/> | 428 | <xsl:apply-templates select="xqx:firstOperand"/> |
428 | <xsl:choose> | 429 | <xsl:choose> |
429 | <xsl:when test="self::xqx:equalOp"> | 430 | <xsl:when test="self::xqx:equalOp"> |
430 | <xsl:text> </xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> | 431 | <xsl:text> </xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> |
431 | </xsl:when> | 432 | </xsl:when> |
432 | <xsl:when test="self::xqx:notEqualOp"> | 433 | <xsl:when test="self::xqx:notEqualOp"> |
433 | <xsl:text> !</xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> | 434 | <xsl:text> !</xsl:text><xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> |
434 | </xsl:when> | 435 | </xsl:when> |
435 | <xsl:when test="self::xqx:lessThanOp"> | 436 | <xsl:when test="self::xqx:lessThanOp"> |
436 | <xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/><xsl:text> </xsl:text> | 437 | <xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/><xsl:text> </xsl:text> |
437 | </xsl:when> | 438 | </xsl:when> |
438 | <xsl:when test="self::xqx:greaterThanOp"> | 439 | <xsl:when test="self::xqx:greaterThanOp"> |
439 | <xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/><xsl:text> </xsl:text> | 440 | <xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/><xsl:text> </xsl:text> |
440 | </xsl:when> | 441 | </xsl:when> |
441 | <xsl:when test="self::xqx:lessThanOrEqualOp"> | 442 | <xsl:when test="self::xqx:lessThanOrEqualOp"> |
442 | <xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/> | 443 | <xsl:text> </xsl:text><xsl:value-of select="$LESSTHAN"/> |
443 | <xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> | 444 | <xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> |
444 | </xsl:when> | 445 | </xsl:when> |
445 | <xsl:when test="self::xqx:greaterThanOrEqualOp"> | 446 | <xsl:when test="self::xqx:greaterThanOrEqualOp"> |
446 | <xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/> | 447 | <xsl:text> </xsl:text><xsl:value-of select="$GREATERTHAN"/> |
447 | <xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> | 448 | <xsl:value-of select="$EQUAL"/><xsl:text> </xsl:text> |
448 | </xsl:when> | 449 | </xsl:when> |
449 | </xsl:choose> | 450 | </xsl:choose> |
450 | <xsl:apply-templates select="xqx:secondOperand"/> | 451 | <xsl:apply-templates select="xqx:secondOperand"/> |
451 | <xsl:value-of select="$RPAREN"/> | 452 | <xsl:value-of select="$RPAREN"/> |
452 | </xsl:template> | 453 | </xsl:template> |
453 | 454 | ||
454 | 455 | ||
455 | <xsl:template match="xqx:isOp | xqx:nodeBeforeOp | xqx:nodeAfterOp"> | 456 | <xsl:template match="xqx:isOp | xqx:nodeBeforeOp | xqx:nodeAfterOp"> |
456 | <xsl:value-of select="$LPAREN"/> | 457 | <xsl:value-of select="$LPAREN"/> |
457 | <xsl:apply-templates select="xqx:firstOperand"/> | 458 | <xsl:apply-templates select="xqx:firstOperand"/> |
458 | <xsl:choose> | 459 | <xsl:choose> |
459 | <xsl:when test="self::xqx:isOp"><xsl:text> is </xsl:text></xsl:when> | 460 | <xsl:when test="self::xqx:isOp"><xsl:text> is </xsl:text></xsl:when> |
460 | <xsl:when test="self::xqx:nodeBeforeOp"><xsl:text> </xsl:text> | 461 | <xsl:when test="self::xqx:nodeBeforeOp"><xsl:text> </xsl:text> |
461 | <xsl:value-of select="$LESSTHAN"/><xsl:value-of select="$LESSTHAN"/> | 462 | <xsl:value-of select="$LESSTHAN"/><xsl:value-of select="$LESSTHAN"/> |
462 | <xsl:text> </xsl:text></xsl:when> | 463 | <xsl:text> </xsl:text></xsl:when> |
463 | <xsl:when test="self::xqx:nodeAfterOp"><xsl:text> </xsl:text> | 464 | <xsl:when test="self::xqx:nodeAfterOp"><xsl:text> </xsl:text> |
464 | <xsl:value-of select="$GREATERTHAN"/><xsl:value-of select="$GREATERTHAN"/> | 465 | <xsl:value-of select="$GREATERTHAN"/><xsl:value-of select="$GREATERTHAN"/> |
465 | <xsl:text> </xsl:text></xsl:when> | 466 | <xsl:text> </xsl:text></xsl:when> |
466 | </xsl:choose> | 467 | </xsl:choose> |
467 | <xsl:apply-templates select="xqx:secondOperand"/> | 468 | <xsl:apply-templates select="xqx:secondOperand"/> |
468 | <xsl:value-of select="$RPAREN"/> | 469 | <xsl:value-of select="$RPAREN"/> |
469 | </xsl:template> | 470 | </xsl:template> |
470 | 471 | ||
471 | 472 | ||
472 | <xsl:template match="xqx:andOp | xqx:orOp"> | 473 | <xsl:template match="xqx:andOp | xqx:orOp"> |
473 | <xsl:value-of select="$LPAREN"/> | 474 | <xsl:value-of select="$LPAREN"/> |
474 | <xsl:apply-templates select="xqx:firstOperand"/> | 475 | <xsl:apply-templates select="xqx:firstOperand"/> |
475 | <xsl:choose> | 476 | <xsl:choose> |
476 | <xsl:when test="self::xqx:andOp"><xsl:text> and </xsl:text></xsl:when> | 477 | <xsl:when test="self::xqx:andOp"><xsl:text> and </xsl:text></xsl:when> |
477 | <xsl:when test="self::xqx:orOp"><xsl:text> or </xsl:text></xsl:when> | 478 | <xsl:when test="self::xqx:orOp"><xsl:text> or </xsl:text></xsl:when> |
478 | </xsl:choose> | 479 | </xsl:choose> |
479 | <xsl:apply-templates select="xqx:secondOperand"/> | 480 | <xsl:apply-templates select="xqx:secondOperand"/> |
480 | <xsl:value-of select="$RPAREN"/> | 481 | <xsl:value-of select="$RPAREN"/> |
481 | </xsl:template> | 482 | </xsl:template> |
482 | 483 | ||
483 | 484 | ||
484 | <xsl:template match="xqx:unionOp | xqx:intersectOp | xqx:exceptOp"> | 485 | <xsl:template match="xqx:unionOp | xqx:intersectOp | xqx:exceptOp"> |
485 | <xsl:value-of select="$LPAREN"/> | 486 | <xsl:value-of select="$LPAREN"/> |
486 | <xsl:apply-templates select="xqx:firstOperand"/> | 487 | <xsl:apply-templates select="xqx:firstOperand"/> |
487 | <xsl:choose> | 488 | <xsl:choose> |
488 | <xsl:when test="self::xqx:unionOp"><xsl:text> union </xsl:text></xsl:when> | 489 | <xsl:when test="self::xqx:unionOp"><xsl:text> union </xsl:text></xsl:when> |
489 | <xsl:when test="self::xqx:intersectOp"><xsl:text> intersect </xsl:text></xsl:when> | 490 | <xsl:when test="self::xqx:intersectOp"><xsl:text> intersect </xsl:text></xsl:when> |
490 | <xsl:when test="self::xqx:exceptOp"><xsl:text> except </xsl:text></xsl:when> | 491 | <xsl:when test="self::xqx:exceptOp"><xsl:text> except </xsl:text></xsl:when> |
491 | </xsl:choose> | 492 | </xsl:choose> |
492 | <xsl:apply-templates select="xqx:secondOperand"/> | 493 | <xsl:apply-templates select="xqx:secondOperand"/> |
493 | <xsl:value-of select="$RPAREN"/> | 494 | <xsl:value-of select="$RPAREN"/> |
494 | </xsl:template> | 495 | </xsl:template> |
495 | 496 | ||
496 | 497 | ||
497 | <xsl:template match="xqx:sequenceExpr"> | 498 | <xsl:template match="xqx:sequenceExpr"> |
498 | <xsl:for-each select="."> | 499 | <xsl:for-each select="."> |
499 | <xsl:call-template name="parenthesizedList"> | 500 | <xsl:call-template name="parenthesizedList"> |
500 | <xsl:with-param name="delimiter" select="$COMMA_NEWLINE"/> | 501 | <xsl:with-param name="delimiter" select="$COMMA_NEWLINE"/> |
501 | </xsl:call-template> | 502 | </xsl:call-template> |
502 | </xsl:for-each> | 503 | </xsl:for-each> |
503 | </xsl:template> | 504 | </xsl:template> |
504 | 505 | ||
505 | 506 | ||
506 | <xsl:template match="xqx:rangeSequenceExpr"> | 507 | <xsl:template match="xqx:rangeSequenceExpr"> |
507 | <xsl:value-of select="$LPAREN"/> | 508 | <xsl:value-of select="$LPAREN"/> |
508 | <xsl:apply-templates select="xqx:startExpr"/> | 509 | <xsl:apply-templates select="xqx:startExpr"/> |
509 | <xsl:value-of select="$TO"/> | 510 | <xsl:value-of select="$TO"/> |
510 | <xsl:apply-templates select="xqx:endExpr"/> | 511 | <xsl:apply-templates select="xqx:endExpr"/> |
511 | <xsl:value-of select="$RPAREN"/> | 512 | <xsl:value-of select="$RPAREN"/> |
512 | </xsl:template> | 513 | </xsl:template> |
513 | 514 | ||
514 | 515 | ||
515 | <xsl:template match="xqx:forClause"> | 516 | <xsl:template match="xqx:forClause"> |
516 | <xsl:text> for </xsl:text> | 517 | <xsl:text> for </xsl:text> |
517 | <xsl:call-template name="commaSeparatedList"/> | 518 | <xsl:call-template name="commaSeparatedList"/> |
518 | <xsl:value-of select="$NEWLINE"/> | 519 | <xsl:value-of select="$NEWLINE"/> |
519 | </xsl:template> | 520 | </xsl:template> |
520 | 521 | ||
521 | <xsl:template match="xqx:forClauseItem"> | 522 | <xsl:template match="xqx:forClauseItem"> |
522 | <xsl:apply-templates/> | 523 | <xsl:apply-templates/> |
523 | </xsl:template> | 524 | </xsl:template> |
524 | 525 | ||
525 | <xsl:template match="xqx:allowingEmpty"> | 526 | <xsl:template match="xqx:allowingEmpty"> |
526 | <xsl:text> allowing empty </xsl:text> | 527 | <xsl:text> allowing empty </xsl:text> |
527 | </xsl:template> | 528 | </xsl:template> |
528 | 529 | ||
529 | <xsl:template match="xqx:forExpr"> | 530 | <xsl:template match="xqx:forExpr"> |
530 | <xsl:value-of select="$NEWLINE"/> | 531 | <xsl:value-of select="$NEWLINE"/> |
531 | <xsl:text> in </xsl:text> | 532 | <xsl:text> in </xsl:text> |
532 | <xsl:apply-templates/> | 533 | <xsl:apply-templates/> |
533 | </xsl:template> | 534 | </xsl:template> |
534 | 535 | ||
535 | 536 | ||
536 | <xsl:template match="xqx:letClause"> | 537 | <xsl:template match="xqx:letClause"> |
537 | <xsl:text> let </xsl:text> | 538 | <xsl:text> let </xsl:text> |
538 | <xsl:call-template name="commaSeparatedList"/> | 539 | <xsl:call-template name="commaSeparatedList"/> |
539 | <xsl:value-of select="$NEWLINE"/> | 540 | <xsl:value-of select="$NEWLINE"/> |
540 | </xsl:template> | 541 | </xsl:template> |
541 | 542 | ||
542 | <xsl:template match="xqx:letClauseItem"> | 543 | <xsl:template match="xqx:letClauseItem"> |
543 | <xsl:apply-templates/> | 544 | <xsl:apply-templates/> |
544 | </xsl:template> | 545 | </xsl:template> |
545 | 546 | ||
546 | <xsl:template match="xqx:letExpr"> | 547 | <xsl:template match="xqx:letExpr"> |
547 | <xsl:value-of select="$SPACE"/> | 548 | <xsl:value-of select="$SPACE"/> |
548 | <xsl:value-of select="$ASSIGN"/> | 549 | <xsl:value-of select="$ASSIGN"/> |
549 | <xsl:value-of select="$SPACE"/> | 550 | <xsl:value-of select="$SPACE"/> |
550 | <xsl:apply-templates/> | 551 | <xsl:apply-templates/> |
551 | </xsl:template> | 552 | </xsl:template> |
552 | 553 | ||
553 | 554 | ||
554 | <xsl:template match="xqx:windowClause"> | 555 | <xsl:template match="xqx:windowClause"> |
555 | <xsl:text> for </xsl:text> | 556 | <xsl:text> for </xsl:text> |
556 | <xsl:apply-templates/> | 557 | <xsl:apply-templates/> |
557 | <xsl:value-of select="$NEWLINE"/> | 558 | <xsl:value-of select="$NEWLINE"/> |
558 | </xsl:template> | 559 | </xsl:template> |
559 | 560 | ||
560 | <xsl:template match="xqx:tumblingWindowClause"> | 561 | <xsl:template match="xqx:tumblingWindowClause"> |
561 | <xsl:text> tumbling window </xsl:text> | 562 | <xsl:text> tumbling window </xsl:text> |
562 | <xsl:apply-templates select="xqx:typedVariableBinding"/> | 563 | <xsl:apply-templates select="xqx:typedVariableBinding"/> |
563 | <xsl:text> in </xsl:text> | 564 | <xsl:text> in </xsl:text> |
564 | <xsl:apply-templates select="xqx:bindingSequence"/> | 565 | <xsl:apply-templates select="xqx:bindingSequence"/> |
565 | <xsl:value-of select="$NEWLINE"/> | 566 | <xsl:value-of select="$NEWLINE"/> |
566 | <xsl:text> </xsl:text> | 567 | <xsl:text> </xsl:text> |
567 | <xsl:apply-templates select="xqx:windowStartCondition"/> | 568 | <xsl:apply-templates select="xqx:windowStartCondition"/> |
568 | <xsl:value-of select="$NEWLINE"/> | 569 | <xsl:value-of select="$NEWLINE"/> |
569 | <xsl:text> </xsl:text> | 570 | <xsl:text> </xsl:text> |
570 | <xsl:apply-templates select="xqx:windowEndCondition"/> | 571 | <xsl:apply-templates select="xqx:windowEndCondition"/> |
571 | </xsl:template> | 572 | </xsl:template> |
572 | 573 | ||
573 | <xsl:template match="xqx:slidingWindowClause"> | 574 | <xsl:template match="xqx:slidingWindowClause"> |
574 | <xsl:text> sliding window </xsl:text> | 575 | <xsl:text> sliding window </xsl:text> |
575 | <xsl:apply-templates select="xqx:typedVariableBinding"/> | 576 | <xsl:apply-templates select="xqx:typedVariableBinding"/> |
576 | <xsl:text> in </xsl:text> | 577 | <xsl:text> in </xsl:text> |
577 | <xsl:apply-templates select="xqx:bindingSequence"/> | 578 | <xsl:apply-templates select="xqx:bindingSequence"/> |
578 | <xsl:value-of select="$NEWLINE"/> | 579 | <xsl:value-of select="$NEWLINE"/> |
579 | <xsl:text> </xsl:text> | 580 | <xsl:text> </xsl:text> |
580 | <xsl:apply-templates select="xqx:windowStartCondition"/> | 581 | <xsl:apply-templates select="xqx:windowStartCondition"/> |
581 | <xsl:value-of select="$NEWLINE"/> | 582 | <xsl:value-of select="$NEWLINE"/> |
582 | <xsl:text> </xsl:text> | 583 | <xsl:text> </xsl:text> |
583 | <xsl:apply-templates select="xqx:windowEndCondition"/> | 584 | <xsl:apply-templates select="xqx:windowEndCondition"/> |
584 | </xsl:template> | 585 | </xsl:template> |
585 | 586 | ||
586 | <xsl:template match="xqx:bindingSequence"> | 587 | <xsl:template match="xqx:bindingSequence"> |
587 | <xsl:apply-templates/> | 588 | <xsl:apply-templates/> |
588 | </xsl:template> | 589 | </xsl:template> |
589 | 590 | ||
590 | <xsl:template match="xqx:windowStartCondition"> | 591 | <xsl:template match="xqx:windowStartCondition"> |
591 | <xsl:text>start </xsl:text> | 592 | <xsl:text>start </xsl:text> |
592 | <xsl:apply-templates select="xqx:windowVars"/> | 593 | <xsl:apply-templates select="xqx:windowVars"/> |
593 | <xsl:text> when </xsl:text> | 594 | <xsl:text> when </xsl:text> |
594 | <xsl:apply-templates select="xqx:winStartExpr"/> | 595 | <xsl:apply-templates select="xqx:winStartExpr"/> |
595 | </xsl:template> | 596 | </xsl:template> |
596 | 597 | ||
597 | <xsl:template match="xqx:windowEndCondition"> | 598 | <xsl:template match="xqx:windowEndCondition"> |
598 | <xsl:if test="@xqx:onlyEnd='true'"> | 599 | <xsl:if test="@xqx:onlyEnd='true'"> |
599 | <xsl:text>only </xsl:text> | 600 | <xsl:text>only </xsl:text> |
600 | </xsl:if> | 601 | </xsl:if> |
601 | <xsl:text>end </xsl:text> | 602 | <xsl:text>end </xsl:text> |
602 | <xsl:apply-templates select="xqx:windowVars"/> | 603 | <xsl:apply-templates select="xqx:windowVars"/> |
603 | <xsl:text> when </xsl:text> | 604 | <xsl:text> when </xsl:text> |
604 | <xsl:apply-templates select="xqx:winEndExpr"/> | 605 | <xsl:apply-templates select="xqx:winEndExpr"/> |
605 | </xsl:template> | 606 | </xsl:template> |
606 | 607 | ||
607 | <xsl:template match="xqx:windowVars"> | 608 | <xsl:template match="xqx:windowVars"> |
608 | <xsl:apply-templates select="xqx:currentItem"/> | 609 | <xsl:apply-templates select="xqx:currentItem"/> |
609 | <xsl:apply-templates select="xqx:positionalVariableBinding"/> | 610 | <xsl:apply-templates select="xqx:positionalVariableBinding"/> |
610 | <xsl:apply-templates select="xqx:previousItem"/> | 611 | <xsl:apply-templates select="xqx:previousItem"/> |
611 | <xsl:apply-templates select="xqx:nextItem"/> | 612 | <xsl:apply-templates select="xqx:nextItem"/> |
612 | </xsl:template> | 613 | </xsl:template> |
613 | 614 | ||
614 | <xsl:template match="xqx:currentItem"> | 615 | <xsl:template match="xqx:currentItem"> |
615 | <xsl:value-of select="$DOLLAR"/> | 616 | <xsl:value-of select="$DOLLAR"/> |
616 | <xsl:call-template name="renderEQName"/> | 617 | <xsl:call-template name="renderEQName"/> |
617 | </xsl:template> | 618 | </xsl:template> |
618 | 619 | ||
619 | <xsl:template match="xqx:previousItem"> | 620 | <xsl:template match="xqx:previousItem"> |
620 | <xsl:text> previous </xsl:text> | 621 | <xsl:text> previous </xsl:text> |
621 | <xsl:value-of select="$DOLLAR"/> | 622 | <xsl:value-of select="$DOLLAR"/> |
622 | <xsl:call-template name="renderEQName"/> | 623 | <xsl:call-template name="renderEQName"/> |
623 | </xsl:template> | 624 | </xsl:template> |
624 | 625 | ||
625 | <xsl:template match="xqx:nextItem"> | 626 | <xsl:template match="xqx:nextItem"> |
626 | <xsl:text> next </xsl:text> | 627 | <xsl:text> next </xsl:text> |
627 | <xsl:value-of select="$DOLLAR"/> | 628 | <xsl:value-of select="$DOLLAR"/> |
628 | <xsl:call-template name="renderEQName"/> | 629 | <xsl:call-template name="renderEQName"/> |
629 | </xsl:template> | 630 | </xsl:template> |
630 | 631 | ||
631 | 632 | ||
632 | <xsl:template match="xqx:countClause"> | 633 | <xsl:template match="xqx:countClause"> |
633 | <xsl:text> count </xsl:text> | 634 | <xsl:text> count </xsl:text> |
634 | <xsl:apply-templates/> | 635 | <xsl:apply-templates/> |
635 | <xsl:value-of select="$NEWLINE"/> | 636 | <xsl:value-of select="$NEWLINE"/> |
636 | </xsl:template> | 637 | </xsl:template> |
637 | 638 | ||
638 | 639 | ||
639 | <xsl:template match="xqx:whereClause"> | 640 | <xsl:template match="xqx:whereClause"> |
640 | <xsl:text> where </xsl:text> | 641 | <xsl:text> where </xsl:text> |
641 | <xsl:apply-templates select="*"/> | 642 | <xsl:apply-templates select="*"/> |
642 | <xsl:value-of select="$NEWLINE"/> | 643 | <xsl:value-of select="$NEWLINE"/> |
643 | </xsl:template> | 644 | </xsl:template> |
644 | 645 | ||
645 | 646 | ||
646 | <xsl:template match="xqx:groupByClause"> | 647 | <xsl:template match="xqx:groupByClause"> |
647 | <xsl:text> group by </xsl:text> | 648 | <xsl:text> group by </xsl:text> |
648 | <xsl:call-template name="commaSeparatedList"/> | 649 | <xsl:call-template name="commaSeparatedList"/> |
649 | <xsl:value-of select="$NEWLINE"/> | 650 | <xsl:value-of select="$NEWLINE"/> |
650 | </xsl:template> | 651 | </xsl:template> |
651 | 652 | ||
652 | 653 | ||
653 | <xsl:template match="xqx:groupingSpec"> | 654 | <xsl:template match="xqx:groupingSpec"> |
654 | <xsl:value-of select="$DOLLAR"/> | 655 | <xsl:value-of select="$DOLLAR"/> |
655 | <xsl:apply-templates/> | 656 | <xsl:apply-templates/> |
656 | </xsl:template> | 657 | </xsl:template> |
657 | 658 | ||
658 | 659 | ||
659 | <xsl:template match="xqx:groupVarInitialize"> | 660 | <xsl:template match="xqx:groupVarInitialize"> |
660 | <xsl:if test="xqx:typeDeclaration"> | 661 | <xsl:if test="xqx:typeDeclaration"> |
661 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 662 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
662 | </xsl:if> | 663 | </xsl:if> |
663 | <xsl:value-of select="$SPACE"/> | 664 | <xsl:value-of select="$SPACE"/> |
664 | <xsl:value-of select="$ASSIGN"/> | 665 | <xsl:value-of select="$ASSIGN"/> |
665 | <xsl:value-of select="$SPACE"/> | 666 | <xsl:value-of select="$SPACE"/> |
666 | <xsl:apply-templates select="xqx:varValue"/> | 667 | <xsl:apply-templates select="xqx:varValue"/> |
667 | </xsl:template> | 668 | </xsl:template> |
668 | 669 | ||
669 | 670 | ||
670 | <xsl:template match="xqx:collation"> | 671 | <xsl:template match="xqx:collation"> |
671 | <xsl:text> collation </xsl:text> | 672 | <xsl:text> collation </xsl:text> |
672 | <xsl:call-template name="quote"> | 673 | <xsl:call-template name="quote"> |
673 | <xsl:with-param name="item"> | 674 | <xsl:with-param name="item"> |
674 | <xsl:value-of select="."/> | 675 | <xsl:value-of select="."/> |
675 | </xsl:with-param> | 676 | </xsl:with-param> |
676 | </xsl:call-template> | 677 | </xsl:call-template> |
677 | </xsl:template> | 678 | </xsl:template> |
678 | 679 | ||
679 | 680 | ||
680 | <xsl:template match="xqx:emptyOrderingMode"> | 681 | <xsl:template match="xqx:emptyOrderingMode"> |
681 | <xsl:value-of select="$SPACE"/> | 682 | <xsl:value-of select="$SPACE"/> |
682 | <xsl:value-of select="."/> | 683 | <xsl:value-of select="."/> |
683 | </xsl:template> | 684 | </xsl:template> |
684 | 685 | ||
685 | 686 | ||
686 | <xsl:template match="xqx:orderingKind"> | 687 | <xsl:template match="xqx:orderingKind"> |
687 | <xsl:value-of select="$SPACE"/> | 688 | <xsl:value-of select="$SPACE"/> |
688 | <xsl:value-of select="."/> | 689 | <xsl:value-of select="."/> |
689 | </xsl:template> | 690 | </xsl:template> |
690 | 691 | ||
691 | 692 | ||
692 | <xsl:template match="xqx:orderModifier"> | 693 | <xsl:template match="xqx:orderModifier"> |
693 | <xsl:apply-templates select="*"/> | 694 | <xsl:apply-templates select="*"/> |
694 | </xsl:template> | 695 | </xsl:template> |
695 | 696 | ||
696 | 697 | ||
697 | <xsl:template match="xqx:orderBySpec"> | 698 | <xsl:template match="xqx:orderBySpec"> |
698 | <xsl:apply-templates select="xqx:orderByExpr"/> | 699 | <xsl:apply-templates select="xqx:orderByExpr"/> |
699 | <xsl:value-of select="$SPACE"/> | 700 | <xsl:value-of select="$SPACE"/> |
700 | <xsl:apply-templates select="xqx:orderModifier"/> | 701 | <xsl:apply-templates select="xqx:orderModifier"/> |
701 | </xsl:template> | 702 | </xsl:template> |
702 | 703 | ||
703 | 704 | ||
704 | <xsl:template match="xqx:orderByClause"> | 705 | <xsl:template match="xqx:orderByClause"> |
705 | <xsl:if test="xqx:stable"> | 706 | <xsl:if test="xqx:stable"> |
706 | <xsl:text> stable</xsl:text> | 707 | <xsl:text> stable</xsl:text> |
707 | </xsl:if> | 708 | </xsl:if> |
708 | <xsl:text> order by </xsl:text> | 709 | <xsl:text> order by </xsl:text> |
709 | <xsl:apply-templates select="xqx:orderBySpec[1]"/> | 710 | <xsl:apply-templates select="xqx:orderBySpec[1]"/> |
710 | <xsl:for-each select="xqx:orderBySpec[position() > 1]"> | 711 | <xsl:for-each select="xqx:orderBySpec[position() > 1]"> |
711 | <xsl:value-of select="$COMMA_SPACE"/> | 712 | <xsl:value-of select="$COMMA_SPACE"/> |
712 | <xsl:apply-templates select="."/> | 713 | <xsl:apply-templates select="."/> |
713 | </xsl:for-each> | 714 | </xsl:for-each> |
714 | <xsl:value-of select="$NEWLINE"/> | 715 | <xsl:value-of select="$NEWLINE"/> |
715 | </xsl:template> | 716 | </xsl:template> |
716 | 717 | ||
717 | 718 | ||
718 | <xsl:template match="xqx:returnClause"> | 719 | <xsl:template match="xqx:returnClause"> |
719 | <xsl:text> return </xsl:text> | 720 | <xsl:text> return </xsl:text> |
720 | <xsl:apply-templates select="*"/> | 721 | <xsl:apply-templates select="*"/> |
721 | <xsl:value-of select="$NEWLINE"/> | 722 | <xsl:value-of select="$NEWLINE"/> |
722 | </xsl:template> | 723 | </xsl:template> |
723 | 724 | ||
724 | 725 | ||
725 | <!-- Surrounding FLWOR expressions with parentheses completes the set --> | 726 | <!-- Surrounding FLWOR expressions with parentheses completes the set --> |
726 | <xsl:template match="xqx:flworExpr"> | 727 | <xsl:template match="xqx:flworExpr"> |
727 | <xsl:value-of select="$NEWLINE"/> | 728 | <xsl:value-of select="$NEWLINE"/> |
728 | <xsl:value-of select="$LPAREN"/> | 729 | <xsl:value-of select="$LPAREN"/> |
729 | <xsl:apply-templates select="*"/> | 730 | <xsl:apply-templates select="*"/> |
730 | <xsl:value-of select="$RPAREN"/> | 731 | <xsl:value-of select="$RPAREN"/> |
731 | </xsl:template> | 732 | </xsl:template> |
732 | 733 | ||
733 | 734 | ||
734 | <xsl:template match="xqx:ifThenElseExpr"> | 735 | <xsl:template match="xqx:ifThenElseExpr"> |
735 | <xsl:value-of select="$LPAREN"/> | 736 | <xsl:value-of select="$LPAREN"/> |
736 | <xsl:text> if </xsl:text> | 737 | <xsl:text> if </xsl:text> |
737 | <xsl:value-of select="$LPAREN"/> | 738 | <xsl:value-of select="$LPAREN"/> |
738 | <xsl:apply-templates select="xqx:ifClause"/> | 739 | <xsl:apply-templates select="xqx:ifClause"/> |
739 | <xsl:value-of select="$RPAREN"/> | 740 | <xsl:value-of select="$RPAREN"/> |
740 | <xsl:text> then </xsl:text> | 741 | <xsl:text> then </xsl:text> |
741 | <xsl:apply-templates select="xqx:thenClause"/> | 742 | <xsl:apply-templates select="xqx:thenClause"/> |
742 | <xsl:text> else </xsl:text> | 743 | <xsl:text> else </xsl:text> |
743 | <xsl:apply-templates select="xqx:elseClause"/> | 744 | <xsl:apply-templates select="xqx:elseClause"/> |
744 | <xsl:value-of select="$RPAREN"/> | 745 | <xsl:value-of select="$RPAREN"/> |
745 | </xsl:template> | 746 | </xsl:template> |
746 | 747 | ||
747 | 748 | ||
748 | <xsl:template match="xqx:positionalVariableBinding"> | 749 | <xsl:template match="xqx:positionalVariableBinding"> |
749 | <xsl:text> at </xsl:text> | 750 | <xsl:text> at </xsl:text> |
750 | <xsl:value-of select="$DOLLAR"/> | 751 | <xsl:value-of select="$DOLLAR"/> |
751 | <xsl:call-template name="renderEQName"/> | 752 | <xsl:call-template name="renderEQName"/> |
752 | </xsl:template> | 753 | </xsl:template> |
753 | 754 | ||
754 | 755 | ||
755 | <xsl:template match="xqx:variableBinding"> | 756 | <xsl:template match="xqx:variableBinding"> |
756 | <xsl:value-of select="$DOLLAR"/> | 757 | <xsl:value-of select="$DOLLAR"/> |
757 | <xsl:call-template name="renderEQName"/> | 758 | <xsl:call-template name="renderEQName"/> |
758 | <xsl:if test="parent::xqx:typeswitchExprCaseClause"> | 759 | <xsl:if test="parent::xqx:typeswitchExprCaseClause"> |
759 | <xsl:text> as </xsl:text> | 760 | <xsl:text> as </xsl:text> |
760 | </xsl:if> | 761 | </xsl:if> |
761 | </xsl:template> | 762 | </xsl:template> |
762 | 763 | ||
763 | 764 | ||
764 | <xsl:template match="xqx:typedVariableBinding" name="typedVariableBinding"> | 765 | <xsl:template match="xqx:typedVariableBinding" name="typedVariableBinding"> |
765 | <xsl:value-of select="$DOLLAR"/> | 766 | <xsl:value-of select="$DOLLAR"/> |
766 | <xsl:apply-templates select="xqx:varName"/> | 767 | <xsl:apply-templates select="xqx:varName"/> |
767 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 768 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
768 | </xsl:template> | 769 | </xsl:template> |
769 | 770 | ||
770 | 771 | ||
771 | <xsl:template match="xqx:quantifiedExprInClause"> | 772 | <xsl:template match="xqx:quantifiedExprInClause"> |
772 | <xsl:apply-templates select="xqx:typedVariableBinding"/> | 773 | <xsl:apply-templates select="xqx:typedVariableBinding"/> |
773 | <xsl:text> in </xsl:text> | 774 | <xsl:text> in </xsl:text> |
774 | <xsl:apply-templates select="xqx:sourceExpr"/> | 775 | <xsl:apply-templates select="xqx:sourceExpr"/> |
775 | </xsl:template> | 776 | </xsl:template> |
776 | 777 | ||
777 | 778 | ||
778 | <xsl:template match="xqx:quantifiedExpr"> | 779 | <xsl:template match="xqx:quantifiedExpr"> |
779 | <xsl:value-of select="$LPAREN"/> | 780 | <xsl:value-of select="$LPAREN"/> |
780 | <xsl:value-of select="xqx:quantifier"/> | 781 | <xsl:value-of select="xqx:quantifier"/> |
781 | <xsl:value-of select="$SPACE"/> | 782 | <xsl:value-of select="$SPACE"/> |
782 | <xsl:apply-templates select="xqx:quantifiedExprInClause[1]"/> | 783 | <xsl:apply-templates select="xqx:quantifiedExprInClause[1]"/> |
783 | <xsl:for-each select="xqx:quantifiedExprInClause[position() > 1]"> | 784 | <xsl:for-each select="xqx:quantifiedExprInClause[position() > 1]"> |
784 | <xsl:value-of select="$COMMA_SPACE"/> | 785 | <xsl:value-of select="$COMMA_SPACE"/> |
785 | <xsl:apply-templates select="."/> | 786 | <xsl:apply-templates select="."/> |
786 | </xsl:for-each> | 787 | </xsl:for-each> |
787 | <xsl:text> satisfies </xsl:text> | 788 | <xsl:text> satisfies </xsl:text> |
788 | <xsl:apply-templates select="xqx:predicateExpr"/> | 789 | <xsl:apply-templates select="xqx:predicateExpr"/> |
789 | <xsl:value-of select="$RPAREN"/> | 790 | <xsl:value-of select="$RPAREN"/> |
790 | </xsl:template> | 791 | </xsl:template> |
791 | 792 | ||
792 | 793 | ||
793 | <xsl:template match="xqx:instanceOfExpr"> | 794 | <xsl:template match="xqx:instanceOfExpr"> |
794 | <xsl:value-of select="$LPAREN"/> | 795 | <xsl:value-of select="$LPAREN"/> |
795 | <xsl:apply-templates select="xqx:argExpr"/> | 796 | <xsl:apply-templates select="xqx:argExpr"/> |
796 | <xsl:text> instance of </xsl:text> | 797 | <xsl:text> instance of </xsl:text> |
797 | <xsl:apply-templates select="xqx:sequenceType"/> | 798 | <xsl:apply-templates select="xqx:sequenceType"/> |
798 | <xsl:value-of select="$RPAREN"/> | 799 | <xsl:value-of select="$RPAREN"/> |
799 | </xsl:template> | 800 | </xsl:template> |
800 | 801 | ||
801 | 802 | ||
802 | <xsl:template match="xqx:castExpr"> | 803 | <xsl:template match="xqx:castExpr"> |
803 | <xsl:value-of select="$LPAREN"/> | 804 | <xsl:value-of select="$LPAREN"/> |
804 | <xsl:apply-templates select="xqx:argExpr"/> | 805 | <xsl:apply-templates select="xqx:argExpr"/> |
805 | <xsl:text> cast as </xsl:text> | 806 | <xsl:text> cast as </xsl:text> |
806 | <xsl:apply-templates select="xqx:singleType"/> | 807 | <xsl:apply-templates select="xqx:singleType"/> |
807 | <xsl:value-of select="$RPAREN"/> | 808 | <xsl:value-of select="$RPAREN"/> |
808 | </xsl:template> | 809 | </xsl:template> |
809 | 810 | ||
810 | 811 | ||
811 | ]]><phrase diff="add" at="2015-02-11"><![CDATA[<!-- 2015-02-11/JM For new expr arrowExpr --> | 812 | ]]><phrase diff="add" at="2015-02-11"><![CDATA[<!-- 2015-02-11/JM For new expr arrowExpr --> |
812 | <xsl:template match="xqx:arrowExpr"> | 813 | <xsl:template match="xqx:arrowExpr"> |
813 | <xsl:value-of select="$LPAREN"/> | 814 | <xsl:value-of select="$LPAREN"/> |
814 | <xsl:value-of select="$SPACE"/> | 815 | <xsl:value-of select="$SPACE"/> |
815 | <xsl:apply-templates select="xqx:argExpr"/> | 816 | <xsl:apply-templates select="xqx:argExpr"/> |
816 | <xsl:for-each select="*[not(self::xqx:argExpr) and not(self::xqx:arguments)]"> | 817 | <xsl:for-each select="*[not(self::xqx:argExpr) and not(self::xqx:arguments)]"> |
817 | <xsl:text> => </xsl:text> | 818 | <xsl:text> => </xsl:text> |
818 | <xsl:apply-templates select="."/> | 819 | <xsl:apply-templates select="."/> |
819 | <xsl:choose> | 820 | <xsl:choose> |
820 | <xsl:when test="following-sibling::*[1][self::xqx:arguments]"> | 821 | <xsl:when test="following-sibling::*[1][self::xqx:arguments]"> |
821 | <xsl:for-each select="following-sibling::*[1][self::xqx:arguments]"> | 822 | <xsl:for-each select="following-sibling::*[1][self::xqx:arguments]"> |
822 | <xsl:call-template name="parenthesizedList"/> | 823 | <xsl:call-template name="parenthesizedList"/> |
823 | </xsl:for-each> | 824 | </xsl:for-each> |
824 | </xsl:when> | 825 | </xsl:when> |
825 | <xsl:otherwise> | 826 | <xsl:otherwise> |
826 | <xsl:value-of select="$LPAREN"/> | 827 | <xsl:value-of select="$LPAREN"/> |
827 | <xsl:value-of select="$RPAREN"/> | 828 | <xsl:value-of select="$RPAREN"/> |
828 | </xsl:otherwise> | 829 | </xsl:otherwise> |
829 | </xsl:choose> | 830 | </xsl:choose> |
830 | </xsl:for-each> | 831 | </xsl:for-each> |
831 | <xsl:value-of select="$SPACE"/> | 832 | <xsl:value-of select="$SPACE"/> |
832 | <xsl:value-of select="$RPAREN"/> | 833 | <xsl:value-of select="$RPAREN"/> |
833 | </xsl:template> | 834 | </xsl:template> |
834 | 835 | ||
835 | 836 | ||
836 | ]]></phrase><![CDATA[ <xsl:template match="xqx:castableExpr"> | 837 | ]]></phrase><![CDATA[ <xsl:template match="xqx:castableExpr"> |
837 | <xsl:value-of select="$LPAREN"/> | 838 | <xsl:value-of select="$LPAREN"/> |
838 | <xsl:apply-templates select="xqx:argExpr"/> | 839 | <xsl:apply-templates select="xqx:argExpr"/> |
839 | <xsl:text> castable as </xsl:text> | 840 | <xsl:text> castable as </xsl:text> |
840 | <xsl:apply-templates select="xqx:singleType"/> | 841 | <xsl:apply-templates select="xqx:singleType"/> |
841 | <xsl:value-of select="$RPAREN"/> | 842 | <xsl:value-of select="$RPAREN"/> |
842 | </xsl:template> | 843 | </xsl:template> |
843 | 844 | ||
844 | 845 | ||
845 | <xsl:template match="xqx:treatExpr"> | 846 | <xsl:template match="xqx:treatExpr"> |
846 | <xsl:value-of select="$LPAREN"/> | 847 | <xsl:value-of select="$LPAREN"/> |
847 | <xsl:apply-templates select="xqx:argExpr"/> | 848 | <xsl:apply-templates select="xqx:argExpr"/> |
848 | <xsl:text> treat as </xsl:text> | 849 | <xsl:text> treat as </xsl:text> |
849 | <xsl:apply-templates select="xqx:sequenceType"/> | 850 | <xsl:apply-templates select="xqx:sequenceType"/> |
850 | <xsl:value-of select="$RPAREN"/> | 851 | <xsl:value-of select="$RPAREN"/> |
851 | </xsl:template> | 852 | </xsl:template> |
852 | 853 | ||
853 | 854 | ||
854 | <xsl:template match="xqx:switchExprCaseClause"> | 855 | <xsl:template match="xqx:switchExprCaseClause"> |
855 | <xsl:for-each select="xqx:switchCaseExpr"> | 856 | <xsl:for-each select="xqx:switchCaseExpr"> |
856 | <xsl:value-of select="$NEWLINE"/> | 857 | <xsl:value-of select="$NEWLINE"/> |
857 | <xsl:text> case (</xsl:text> | 858 | <xsl:text> case (</xsl:text> |
858 | <xsl:apply-templates select="."/> | 859 | <xsl:apply-templates select="."/> |
859 | <xsl:text>) </xsl:text> | 860 | <xsl:text>) </xsl:text> |
860 | </xsl:for-each> | 861 | </xsl:for-each> |
861 | <xsl:value-of select="$NEWLINE"/> | 862 | <xsl:value-of select="$NEWLINE"/> |
862 | <xsl:text> return </xsl:text> | 863 | <xsl:text> return </xsl:text> |
863 | <xsl:apply-templates select="xqx:resultExpr"/> | 864 | <xsl:apply-templates select="xqx:resultExpr"/> |
864 | </xsl:template> | 865 | </xsl:template> |
865 | 866 | ||
866 | <xsl:template match="xqx:switchExprDefaultClause"> | 867 | <xsl:template match="xqx:switchExprDefaultClause"> |
867 | <xsl:value-of select="$NEWLINE"/> | 868 | <xsl:value-of select="$NEWLINE"/> |
868 | <xsl:text> default return </xsl:text> | 869 | <xsl:text> default return </xsl:text> |
869 | <xsl:apply-templates select="xqx:resultExpr"/> | 870 | <xsl:apply-templates select="xqx:resultExpr"/> |
870 | </xsl:template> | 871 | </xsl:template> |
871 | 872 | ||
872 | 873 | ||
873 | <xsl:template match="xqx:switchExpr"> | 874 | <xsl:template match="xqx:switchExpr"> |
874 | <xsl:value-of select="$LPAREN"/> | 875 | <xsl:value-of select="$LPAREN"/> |
875 | <xsl:text>switch</xsl:text> | 876 | <xsl:text>switch</xsl:text> |
876 | <xsl:value-of select="$LPAREN"/> | 877 | <xsl:value-of select="$LPAREN"/> |
877 | <xsl:apply-templates select="xqx:argExpr"/> | 878 | <xsl:apply-templates select="xqx:argExpr"/> |
878 | <xsl:value-of select="$RPAREN"/> | 879 | <xsl:value-of select="$RPAREN"/> |
879 | <xsl:apply-templates select="xqx:switchExprCaseClause"/> | 880 | <xsl:apply-templates select="xqx:switchExprCaseClause"/> |
880 | <xsl:apply-templates select="xqx:switchExprDefaultClause"/> | 881 | <xsl:apply-templates select="xqx:switchExprDefaultClause"/> |
881 | <xsl:value-of select="$RPAREN"/> | 882 | <xsl:value-of select="$RPAREN"/> |
882 | </xsl:template> | 883 | </xsl:template> |
883 | 884 | ||
884 | 885 | ||
885 | <xsl:template match="xqx:typeswitchExprCaseClause"> | 886 | <xsl:template match="xqx:typeswitchExprCaseClause"> |
886 | <xsl:text> case </xsl:text> | 887 | <xsl:text> case </xsl:text> |
887 | <xsl:apply-templates select="xqx:variableBinding"/> | 888 | <xsl:apply-templates select="xqx:variableBinding"/> |
888 | <xsl:apply-templates select="xqx:sequenceType | xqx:sequenceTypeUnion"/> | 889 | <xsl:apply-templates select="xqx:sequenceType | xqx:sequenceTypeUnion"/> |
889 | <xsl:text> return </xsl:text> | 890 | <xsl:text> return </xsl:text> |
890 | <xsl:apply-templates select="xqx:resultExpr"/> | 891 | <xsl:apply-templates select="xqx:resultExpr"/> |
891 | </xsl:template> | 892 | </xsl:template> |
892 | 893 | ||
893 | 894 | ||
894 | <xsl:template match="xqx:typeswitchExprDefaultClause"> | 895 | <xsl:template match="xqx:typeswitchExprDefaultClause"> |
895 | <xsl:text> default </xsl:text> | 896 | <xsl:text> default </xsl:text> |
896 | <xsl:apply-templates select="xqx:variableBinding"/> | 897 | <xsl:apply-templates select="xqx:variableBinding"/> |
897 | <xsl:text> return </xsl:text> | 898 | <xsl:text> return </xsl:text> |
898 | <xsl:apply-templates select="xqx:resultExpr"/> | 899 | <xsl:apply-templates select="xqx:resultExpr"/> |
899 | </xsl:template> | 900 | </xsl:template> |
900 | 901 | ||
901 | 902 | ||
902 | <xsl:template match="xqx:typeswitchExpr"> | 903 | <xsl:template match="xqx:typeswitchExpr"> |
903 | <xsl:value-of select="$LPAREN"/> | 904 | <xsl:value-of select="$LPAREN"/> |
904 | <xsl:text>typeswitch</xsl:text> | 905 | <xsl:text>typeswitch</xsl:text> |
905 | <xsl:value-of select="$LPAREN"/> | 906 | <xsl:value-of select="$LPAREN"/> |
906 | <xsl:apply-templates select="xqx:argExpr"/> | 907 | <xsl:apply-templates select="xqx:argExpr"/> |
907 | <xsl:value-of select="$RPAREN"/> | 908 | <xsl:value-of select="$RPAREN"/> |
908 | <xsl:apply-templates select="xqx:typeswitchExprCaseClause"/> | 909 | <xsl:apply-templates select="xqx:typeswitchExprCaseClause"/> |
909 | <xsl:apply-templates select="xqx:typeswitchExprDefaultClause"/> | 910 | <xsl:apply-templates select="xqx:typeswitchExprDefaultClause"/> |
910 | <xsl:value-of select="$RPAREN"/> | 911 | <xsl:value-of select="$RPAREN"/> |
911 | </xsl:template> | 912 | </xsl:template> |
912 | 913 | ||
913 | 914 | ||
914 | <xsl:template match="xqx:tryCatchExpr"> | 915 | <xsl:template match="xqx:tryCatchExpr"> |
915 | <xsl:value-of select="$NEWLINE"/> | 916 | <xsl:value-of select="$NEWLINE"/> |
916 | <xsl:value-of select="$LPAREN"/> | 917 | <xsl:value-of select="$LPAREN"/> |
917 | <xsl:text>try </xsl:text> | 918 | <xsl:text>try </xsl:text> |
918 | <xsl:apply-templates select="xqx:tryClause"/> | 919 | <xsl:apply-templates select="xqx:tryClause"/> |
919 | <xsl:apply-templates select="xqx:catchClause"/> | 920 | <xsl:apply-templates select="xqx:catchClause"/> |
920 | <xsl:value-of select="$RPAREN"/> | 921 | <xsl:value-of select="$RPAREN"/> |
921 | </xsl:template> | 922 | </xsl:template> |
922 | 923 | ||
923 | 924 | ||
924 | <xsl:template match="xqx:tryClause"> | 925 | <xsl:template match="xqx:tryClause"> |
925 | <xsl:value-of select="$LBRACE"/> | 926 | <xsl:value-of select="$LBRACE"/> |
926 | <xsl:value-of select="$SPACE"/> | 927 | <xsl:value-of select="$SPACE"/> |
927 | <xsl:apply-templates/> | 928 | <xsl:apply-templates/> |
928 | <xsl:value-of select="$SPACE"/> | 929 | <xsl:value-of select="$SPACE"/> |
929 | <xsl:value-of select="$RBRACE"/> | 930 | <xsl:value-of select="$RBRACE"/> |
930 | </xsl:template> | 931 | </xsl:template> |
931 | 932 | ||
932 | 933 | ||
933 | <xsl:template match="xqx:catchClause"> | 934 | <xsl:template match="xqx:catchClause"> |
934 | <xsl:value-of select="$NEWLINE"/> | 935 | <xsl:value-of select="$NEWLINE"/> |
935 | <xsl:text> catch </xsl:text> | 936 | <xsl:text> catch </xsl:text> |
936 | <xsl:apply-templates select="xqx:catchErrorList"/> | 937 | <xsl:apply-templates select="xqx:catchErrorList"/> |
937 | <xsl:apply-templates select="xqx:catchExpr"/> | 938 | <xsl:apply-templates select="xqx:catchExpr"/> |
938 | </xsl:template> | 939 | </xsl:template> |
939 | 940 | ||
940 | 941 | ||
941 | <xsl:template match="xqx:catchErrorList"> | 942 | <xsl:template match="xqx:catchErrorList"> |
942 | <xsl:for-each select="xqx:nameTest | xqx:Wildcard"> | 943 | <xsl:for-each select="xqx:nameTest | xqx:Wildcard"> |
943 | <xsl:if test="(position() mod 5) = 0"> | 944 | <xsl:if test="(position() mod 5) = 0"> |
944 | <xsl:value-of select="$NEWLINE"/> | 945 | <xsl:value-of select="$NEWLINE"/> |
945 | <xsl:text> </xsl:text> | 946 | <xsl:text> </xsl:text> |
946 | </xsl:if> | 947 | </xsl:if> |
947 | <xsl:if test="position() > 1"> | 948 | <xsl:if test="position() > 1"> |
948 | <xsl:text>| </xsl:text> | 949 | <xsl:text>| </xsl:text> |
949 | </xsl:if> | 950 | </xsl:if> |
950 | <xsl:apply-templates select="."/> | 951 | <xsl:apply-templates select="."/> |
951 | <xsl:value-of select="$SPACE"/> | 952 | <xsl:value-of select="$SPACE"/> |
952 | </xsl:for-each> | 953 | </xsl:for-each> |
953 | </xsl:template> | 954 | </xsl:template> |
954 | 955 | ||
955 | 956 | ||
956 | <xsl:template match="xqx:catchExpr"> | 957 | <xsl:template match="xqx:catchExpr"> |
957 | <xsl:value-of select="$NEWLINE"/> | 958 | <xsl:value-of select="$NEWLINE"/> |
958 | <xsl:value-of select="$LBRACE"/> | 959 | <xsl:value-of select="$LBRACE"/> |
959 | <xsl:value-of select="$SPACE"/> | 960 | <xsl:value-of select="$SPACE"/> |
960 | <xsl:apply-templates/> | 961 | <xsl:apply-templates/> |
961 | <xsl:value-of select="$SPACE"/> | 962 | <xsl:value-of select="$SPACE"/> |
962 | <xsl:value-of select="$RBRACE"/> | 963 | <xsl:value-of select="$RBRACE"/> |
963 | </xsl:template> | 964 | </xsl:template> |
964 | 965 | ||
965 | 966 | ||
966 | <xsl:template match="xqx:validateExpr"> | 967 | <xsl:template match="xqx:validateExpr"> |
967 | <xsl:value-of select="$LPAREN"/> | 968 | <xsl:value-of select="$LPAREN"/> |
968 | <xsl:text> validate </xsl:text> | 969 | <xsl:text> validate </xsl:text> |
969 | <xsl:if test="xqx:validationMode"> | 970 | <xsl:if test="xqx:validationMode"> |
970 | <xsl:value-of select="xqx:validationMode"/> | 971 | <xsl:value-of select="xqx:validationMode"/> |
971 | <xsl:value-of select="$SPACE"/> | 972 | <xsl:value-of select="$SPACE"/> |
972 | </xsl:if> | 973 | </xsl:if> |
973 | <xsl:if test="xqx:typeName"> | 974 | <xsl:if test="xqx:typeName"> |
974 | <xsl:text>type </xsl:text> | 975 | <xsl:text>type </xsl:text> |
975 | <xsl:apply-templates select="xqx:typeName"/> | 976 | <xsl:apply-templates select="xqx:typeName"/> |
976 | <xsl:value-of select="$SPACE"/> | 977 | <xsl:value-of select="$SPACE"/> |
977 | </xsl:if> | 978 | </xsl:if> |
978 | <xsl:value-of select="$LBRACE"/> | 979 | <xsl:value-of select="$LBRACE"/> |
979 | <xsl:apply-templates select="xqx:argExpr"/> | 980 | <xsl:apply-templates select="xqx:argExpr"/> |
980 | <xsl:value-of select="$SPACE"/> | 981 | <xsl:value-of select="$SPACE"/> |
981 | <xsl:value-of select="$RBRACE"/> | 982 | <xsl:value-of select="$RBRACE"/> |
982 | <xsl:value-of select="$SPACE"/> | 983 | <xsl:value-of select="$SPACE"/> |
983 | <xsl:value-of select="$RPAREN"/> | 984 | <xsl:value-of select="$RPAREN"/> |
984 | </xsl:template> | 985 | </xsl:template> |
985 | 986 | ||
986 | 987 | ||
987 | <xsl:template match="xqx:xpathAxis"> | 988 | <xsl:template match="xqx:xpathAxis"> |
988 | <xsl:value-of select="."/> | 989 | <xsl:value-of select="."/> |
989 | <xsl:value-of select="$DOUBLE_COLON"/> | 990 | <xsl:value-of select="$DOUBLE_COLON"/> |
990 | </xsl:template> | 991 | </xsl:template> |
991 | 992 | ||
992 | 993 | ||
993 | <xsl:template match="xqx:predicates"> | 994 | <xsl:template match="xqx:predicates"> |
994 | <xsl:for-each select="*"> | 995 | <xsl:for-each select="*"> |
995 | <xsl:value-of select="$LBRACKET"/> | 996 | <xsl:value-of select="$LBRACKET"/> |
996 | <xsl:apply-templates select="."/> | 997 | <xsl:apply-templates select="."/> |
997 | <xsl:value-of select="$RBRACKET"/> | 998 | <xsl:value-of select="$RBRACKET"/> |
998 | </xsl:for-each> | 999 | </xsl:for-each> |
999 | </xsl:template> | 1000 | </xsl:template> |
1000 | 1001 | ||
1001 | 1002 | ||
1002 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Used in revised stepExpr to support new alternatives l ookup (formerly mapLookup) --> | 1003 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Used in revised stepExpr to support new alternatives l ookup (formerly mapLookup) --> |
1003 | <xsl:template match="xqx:predicate"> | 1004 | <xsl:template match="xqx:predicate"> |
1004 | <xsl:value-of select="$LBRACKET"/> | 1005 | <xsl:value-of select="$LBRACKET"/> |
1005 | <xsl:apply-templates/> | 1006 | <xsl:apply-templates/> |
1006 | <xsl:value-of select="$RBRACKET"/> | 1007 | <xsl:value-of select="$RBRACKET"/> |
1007 | </xsl:template> | 1008 | </xsl:template> |
1008 | 1009 | ||
1009 | 1010 | ||
1010 | ]]></phrase><![CDATA[ <!-- part of higher-order functions --> | 1011 | ]]></phrase><![CDATA[ <!-- part of higher-order functions --> |
1011 | <xsl:template match="xqx:dynamicFunctionInvocationExpr"> | 1012 | <xsl:template match="xqx:dynamicFunctionInvocationExpr"> |
1012 | <xsl:apply-templates select="xqx:functionItem"/> | 1013 | <xsl:apply-templates select="xqx:functionItem"/> |
1013 | <xsl:apply-templates select="xqx:predicates"/> | 1014 | <xsl:apply-templates select="xqx:predicates"/> |
1014 | <xsl:choose> | 1015 | <xsl:choose> |
1015 | <xsl:when test="xqx:arguments"> | 1016 | <xsl:when test="xqx:arguments"> |
1016 | <xsl:for-each select="xqx:arguments"> | 1017 | <xsl:for-each select="xqx:arguments"> |
1017 | <xsl:call-template name="parenthesizedList"/> | 1018 | <xsl:call-template name="parenthesizedList"/> |
1018 | </xsl:for-each> | 1019 | </xsl:for-each> |
1019 | </xsl:when> | 1020 | </xsl:when> |
1020 | <xsl:otherwise> | 1021 | <xsl:otherwise> |
1021 | <xsl:value-of select="$LPAREN"/> | 1022 | <xsl:value-of select="$LPAREN"/> |
1022 | <xsl:value-of select="$RPAREN"/> | 1023 | <xsl:value-of select="$RPAREN"/> |
1023 | </xsl:otherwise> | 1024 | </xsl:otherwise> |
1024 | </xsl:choose> | 1025 | </xsl:choose> |
1025 | </xsl:template> | 1026 | </xsl:template> |
1026 | 1027 | ||
1027 | 1028 | ||
1028 | <!-- part of higher-order functions --> | 1029 | <!-- part of higher-order functions --> |
1029 | <xsl:template match="xqx:functionItem"> | 1030 | <xsl:template match="xqx:functionItem"> |
1030 | <xsl:apply-templates/> | 1031 | <xsl:apply-templates/> |
1031 | </xsl:template> | 1032 | </xsl:template> |
1032 | 1033 | ||
1033 | 1034 | ||
1034 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Added mapConstructor --> | 1035 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-13/JM Added mapConstructor --> |
1035 | <xsl:template match="xqx:mapConstructor"> | 1036 | <xsl:template match="xqx:mapConstructor"> |
1036 | <xsl:text>map { </xsl:text> | 1037 | <xsl:text>map { </xsl:text> |
1037 | <xsl:apply-templates select="xqx:mapConstructorEntry[1]"/> | 1038 | <xsl:apply-templates select="xqx:mapConstructorEntry[1]"/> |
1038 | <xsl:if test="xqx:mapConstructorEntry[2]"> | 1039 | <xsl:if test="xqx:mapConstructorEntry[2]"> |
1039 | <xsl:for-each select="xqx:mapConstructorEntry[position() > 1]"> | 1040 | <xsl:for-each select="xqx:mapConstructorEntry[position() > 1]"> |
1040 | <xsl:text> , </xsl:text> | 1041 | <xsl:text> , </xsl:text> |
1041 | <xsl:apply-templates select="."/> | 1042 | <xsl:apply-templates select="."/> |
1042 | </xsl:for-each> | 1043 | </xsl:for-each> |
1043 | </xsl:if> | 1044 | </xsl:if> |
1044 | <xsl:text> } </xsl:text> | 1045 | <xsl:text> } </xsl:text> |
1045 | </xsl:template> | 1046 | </xsl:template> |
1046 | 1047 | ||
1047 | <!-- 2014-07-13/JM Added mapConstructorEntry --> | 1048 | <!-- 2014-07-13/JM Added mapConstructorEntry --> |
1048 | <xsl:template match="xqx:mapConstructorEntry"> | 1049 | <xsl:template match="xqx:mapConstructorEntry"> |
1049 | <xsl:apply-templates select="*[1]"/> | 1050 | <xsl:apply-templates select="*[1]"/> |
1050 | <xsl:text> : </xsl:text> | 1051 | <xsl:text> : </xsl:text> |
1051 | <xsl:apply-templates select="*[2]"/> | 1052 | <xsl:apply-templates select="*[2]"/> |
1052 | </xsl:template> | 1053 | </xsl:template> |
1053 | 1054 | ||
1054 | 1055 | ||
1055 | <!-- 2014-07-13/JM Added arrayConstructor --> | 1056 | <!-- 2014-07-13/JM Added arrayConstructor --> |
1056 | <xsl:template match="xqx:arrayConstructor"> | 1057 | <xsl:template match="xqx:arrayConstructor"> |
1057 | <xsl:apply-templates/> | 1058 | <xsl:apply-templates/> |
1058 | </xsl:template> | 1059 | </xsl:template> |
1059 | 1060 | ||
1060 | 1061 | ||
1061 | <!-- 2014-07-13/JM Added squareArray --> | 1062 | <!-- 2014-07-13/JM Added squareArray --> |
1062 | <xsl:template match="xqx:squareArray"> | 1063 | <xsl:template match="xqx:squareArray"> |
1063 | <xsl:text> [ </xsl:text> | 1064 | <xsl:text> [ </xsl:text> |
1064 | <xsl:apply-templates select="xqx:arrayElem[1]"/> | 1065 | <xsl:apply-templates select="xqx:arrayElem[1]"/> |
1065 | <xsl:if test="xqx:arrayElem[2]"> | 1066 | <xsl:if test="xqx:arrayElem[2]"> |
1066 | <xsl:for-each select="xqx:arrayElem[position() > 1]"> | 1067 | <xsl:for-each select="xqx:arrayElem[position() > 1]"> |
1067 | <xsl:text> , </xsl:text> | 1068 | <xsl:text> , </xsl:text> |
1068 | <xsl:apply-templates select="."/> | 1069 | <xsl:apply-templates select="."/> |
1069 | </xsl:for-each> | 1070 | </xsl:for-each> |
1070 | </xsl:if> | 1071 | </xsl:if> |
1071 | <xsl:text> ] </xsl:text> | 1072 | <xsl:text> ] </xsl:text> |
1072 | </xsl:template> | 1073 | </xsl:template> |
1073 | 1074 | ||
1074 | 1075 | ||
1075 | <!-- 2014-07-13/JM Added curlyArray --> | 1076 | <!-- 2014-07-13/JM Added curlyArray --> |
1076 | <xsl:template match="xqx:curlyArray"> | 1077 | <xsl:template match="xqx:curlyArray"> |
1077 | <xsl:text> array { </xsl:text> | 1078 | <xsl:text> array { </xsl:text> |
1078 | <xsl:apply-templates/> | 1079 | <xsl:apply-templates/> |
1079 | <xsl:text> } </xsl:text> | 1080 | <xsl:text> } </xsl:text> |
1080 | </xsl:template> | 1081 | </xsl:template> |
1081 | 1082 | ||
1082 | 1083 | ||
1084 | ]]></phrase><phrase diff="add" at="2015-11-05"><![CDATA[<!-- 2015-11-05/JS Added stringConstructor --> |
||
1085 | <xsl:template match="xqx:stringConstructor"> | ||
1086 | <xsl:text>``[</xsl:text> | ||
1087 | <xsl:apply-templates/> | ||
1088 | <xsl:text>]``</xsl:text> | ||
1089 | </xsl:template> | ||
1090 | |||
1091 | <!-- 2015-11-05/JS Added stringConstructorInterpolation --> | ||
1092 | <xsl:template match="xqx:stringConstructorInterpolation"> | ||
1093 | <xsl:text>`{</xsl:text> | ||
1094 | <xsl:apply-templates/> | ||
1095 | <xsl:text>}`</xsl:text> | ||
1096 | </xsl:template> | ||
1097 | |||
1098 | <!-- 2015-11-05/JS Added stringConstructorChars --> | ||
1099 | <xsl:template match="xqx:stringConstructorChars"> | ||
1100 | <xsl:value-of select="."/> | ||
1101 | </xsl:template> | ||
1102 | |||
1103 | |||
1083 | ]]></phrase><![CDATA[ <xsl:template match="xqx:star"> | 1104 | ]]></phrase><![CDATA[ <xsl:template match="xqx:star"> |
1084 | <xsl:value-of select="$STAR"/> | 1105 | <xsl:value-of select="$STAR"/> |
1085 | </xsl:template> | 1106 | </xsl:template> |
1086 | 1107 | ||
1087 | 1108 | ||
1088 | <xsl:template match="xqx:Wildcard[*]"> | 1109 | <xsl:template match="xqx:Wildcard[*]"> |
1089 | <xsl:choose> | 1110 | <xsl:choose> |
1090 | <xsl:when test="local-name(./child::*[1])='star'"> | 1111 | <xsl:when test="local-name(./child::*[1])='star'"> |
1091 | <xsl:apply-templates select="xqx:star"/> | 1112 | <xsl:apply-templates select="xqx:star"/> |
1092 | <xsl:value-of select="$COLON"/> | 1113 | <xsl:value-of select="$COLON"/> |
1093 | <xsl:apply-templates select="xqx:NCName"/> | 1114 | <xsl:apply-templates select="xqx:NCName"/> |
1094 | </xsl:when> | 1115 | </xsl:when> |
1095 | <xsl:when test="local-name(./child::*[1])='NCName'"> | 1116 | <xsl:when test="local-name(./child::*[1])='NCName'"> |
1096 | <xsl:apply-templates select="xqx:NCName"/> | 1117 | <xsl:apply-templates select="xqx:NCName"/> |
1097 | <xsl:value-of select="$COLON"/> | 1118 | <xsl:value-of select="$COLON"/> |
1098 | <xsl:apply-templates select="xqx:star"/> | 1119 | <xsl:apply-templates select="xqx:star"/> |
1099 | </xsl:when> | 1120 | </xsl:when> |
1100 | <xsl:when test="local-name(./child::*[1])='uri'"> | 1121 | <xsl:when test="local-name(./child::*[1])='uri'"> |
1101 | <xsl:text>Q</xsl:text> | 1122 | <xsl:text>Q</xsl:text> |
1102 | <xsl:value-of select="$LBRACE"/> | 1123 | <xsl:value-of select="$LBRACE"/> |
1103 | <xsl:value-of select="./xqx:uri"/> | 1124 | <xsl:value-of select="./xqx:uri"/> |
1104 | <xsl:value-of select="$RBRACE"/> | 1125 | <xsl:value-of select="$RBRACE"/> |
1105 | <xsl:apply-templates select="xqx:star"/> | 1126 | <xsl:apply-templates select="xqx:star"/> |
1106 | </xsl:when> | 1127 | </xsl:when> |
1107 | </xsl:choose> | 1128 | </xsl:choose> |
1108 | </xsl:template> | 1129 | </xsl:template> |
1109 | 1130 | ||
1110 | 1131 | ||
1111 | <xsl:template match="xqx:Wildcard[not(*)]"> | 1132 | <xsl:template match="xqx:Wildcard[not(*)]"> |
1112 | <xsl:value-of select="$STAR"/> | 1133 | <xsl:value-of select="$STAR"/> |
1113 | </xsl:template> | 1134 | </xsl:template> |
1114 | 1135 | ||
1115 | 1136 | ||
1116 | <xsl:template name="simpleWildcard" match="xqx:simpleWildcard"> | 1137 | <xsl:template name="simpleWildcard" match="xqx:simpleWildcard"> |
1117 | <xsl:apply-templates select="xqx:star"/> | 1138 | <xsl:apply-templates select="xqx:star"/> |
1118 | <xsl:apply-templates select="xqx:QName"/> | 1139 | <xsl:apply-templates select="xqx:QName"/> |
1119 | </xsl:template> | 1140 | </xsl:template> |
1120 | 1141 | ||
1121 | 1142 | ||
1122 | <xsl:template match="xqx:textTest"> | 1143 | <xsl:template match="xqx:textTest"> |
1123 | <xsl:text>text()</xsl:text> | 1144 | <xsl:text>text()</xsl:text> |
1124 | </xsl:template> | 1145 | </xsl:template> |
1125 | 1146 | ||
1126 | 1147 | ||
1127 | <xsl:template match="xqx:commentTest"> | 1148 | <xsl:template match="xqx:commentTest"> |
1128 | <xsl:text>comment()</xsl:text> | 1149 | <xsl:text>comment()</xsl:text> |
1129 | </xsl:template> | 1150 | </xsl:template> |
1130 | 1151 | ||
1131 | 1152 | ||
1132 | <xsl:template match="xqx:namespaceTest"> | 1153 | <xsl:template match="xqx:namespaceTest"> |
1133 | <xsl:text>namespace-node()</xsl:text> | 1154 | <xsl:text>namespace-node()</xsl:text> |
1134 | </xsl:template> | 1155 | </xsl:template> |
1135 | 1156 | ||
1136 | 1157 | ||
1137 | <xsl:template match="xqx:anyKindTest"> | 1158 | <xsl:template match="xqx:anyKindTest"> |
1138 | <xsl:text>node()</xsl:text> | 1159 | <xsl:text>node()</xsl:text> |
1139 | </xsl:template> | 1160 | </xsl:template> |
1140 | 1161 | ||
1141 | 1162 | ||
1142 | <xsl:template match="xqx:piTest"> | 1163 | <xsl:template match="xqx:piTest"> |
1143 | <xsl:text>processing-instruction</xsl:text> | 1164 | <xsl:text>processing-instruction</xsl:text> |
1144 | <xsl:value-of select="$LPAREN"/> | 1165 | <xsl:value-of select="$LPAREN"/> |
1145 | <xsl:value-of select="*"/> | 1166 | <xsl:value-of select="*"/> |
1146 | <xsl:value-of select="$RPAREN"/> | 1167 | <xsl:value-of select="$RPAREN"/> |
1147 | </xsl:template> | 1168 | </xsl:template> |
1148 | 1169 | ||
1149 | 1170 | ||
1150 | <xsl:template match="xqx:documentTest"> | 1171 | <xsl:template match="xqx:documentTest"> |
1151 | <xsl:text>document-node</xsl:text> | 1172 | <xsl:text>document-node</xsl:text> |
1152 | <xsl:value-of select="$LPAREN"/> | 1173 | <xsl:value-of select="$LPAREN"/> |
1153 | <xsl:apply-templates select="*"/> | 1174 | <xsl:apply-templates select="*"/> |
1154 | <xsl:value-of select="$RPAREN"/> | 1175 | <xsl:value-of select="$RPAREN"/> |
1155 | </xsl:template> | 1176 | </xsl:template> |
1156 | 1177 | ||
1157 | <xsl:template match="xqx:nameTest"> | 1178 | <xsl:template match="xqx:nameTest"> |
1158 | <xsl:call-template name="renderEQName"/> | 1179 | <xsl:call-template name="renderEQName"/> |
1159 | </xsl:template> | 1180 | </xsl:template> |
1160 | 1181 | ||
1161 | 1182 | ||
1162 | <xsl:template match="xqx:attributeTest"> | 1183 | <xsl:template match="xqx:attributeTest"> |
1163 | <xsl:text>attribute</xsl:text> | 1184 | <xsl:text>attribute</xsl:text> |
1164 | <xsl:value-of select="$LPAREN"/> | 1185 | <xsl:value-of select="$LPAREN"/> |
1165 | <xsl:for-each select="xqx:attributeName"> | 1186 | <xsl:for-each select="xqx:attributeName"> |
1166 | <xsl:call-template name="simpleWildcard"/> | 1187 | <xsl:call-template name="simpleWildcard"/> |
1167 | </xsl:for-each> | 1188 | </xsl:for-each> |
1168 | <xsl:if test="xqx:typeName"> | 1189 | <xsl:if test="xqx:typeName"> |
1169 | <xsl:value-of select="$COMMA"/> | 1190 | <xsl:value-of select="$COMMA"/> |
1170 | <xsl:apply-templates select="xqx:typeName"/> | 1191 | <xsl:apply-templates select="xqx:typeName"/> |
1171 | </xsl:if> | 1192 | </xsl:if> |
1172 | <xsl:value-of select="$RPAREN"/> | 1193 | <xsl:value-of select="$RPAREN"/> |
1173 | </xsl:template> | 1194 | </xsl:template> |
1174 | 1195 | ||
1175 | 1196 | ||
1176 | <xsl:template match="xqx:elementTest"> | 1197 | <xsl:template match="xqx:elementTest"> |
1177 | <xsl:text>element</xsl:text> | 1198 | <xsl:text>element</xsl:text> |
1178 | <xsl:value-of select="$LPAREN"/> | 1199 | <xsl:value-of select="$LPAREN"/> |
1179 | <xsl:for-each select="xqx:elementName"> | 1200 | <xsl:for-each select="xqx:elementName"> |
1180 | <xsl:call-template name="simpleWildcard"/> | 1201 | <xsl:call-template name="simpleWildcard"/> |
1181 | </xsl:for-each> | 1202 | </xsl:for-each> |
1182 | <xsl:if test="xqx:typeName"> | 1203 | <xsl:if test="xqx:typeName"> |
1183 | <xsl:value-of select="$COMMA"/> | 1204 | <xsl:value-of select="$COMMA"/> |
1184 | <xsl:apply-templates select="xqx:typeName"/> | 1205 | <xsl:apply-templates select="xqx:typeName"/> |
1185 | </xsl:if> | 1206 | </xsl:if> |
1186 | <xsl:if test="xqx:nillable"> | 1207 | <xsl:if test="xqx:nillable"> |
1187 | <xsl:value-of select="$QUESTIONMARK"/> | 1208 | <xsl:value-of select="$QUESTIONMARK"/> |
1188 | </xsl:if> | 1209 | </xsl:if> |
1189 | <xsl:value-of select="$RPAREN"/> | 1210 | <xsl:value-of select="$RPAREN"/> |
1190 | </xsl:template> | 1211 | </xsl:template> |
1191 | 1212 | ||
1192 | 1213 | ||
1193 | <xsl:template match="xqx:schemaElementTest"> | 1214 | <xsl:template match="xqx:schemaElementTest"> |
1194 | <xsl:text>schema-element</xsl:text> | 1215 | <xsl:text>schema-element</xsl:text> |
1195 | <xsl:value-of select="$LPAREN"/> | 1216 | <xsl:value-of select="$LPAREN"/> |
1196 | <xsl:call-template name="renderEQName"/> | 1217 | <xsl:call-template name="renderEQName"/> |
1197 | <xsl:value-of select="$RPAREN"/> | 1218 | <xsl:value-of select="$RPAREN"/> |
1198 | </xsl:template> | 1219 | </xsl:template> |
1199 | 1220 | ||
1200 | 1221 | ||
1201 | <xsl:template match="xqx:schemaAttributeTest"> | 1222 | <xsl:template match="xqx:schemaAttributeTest"> |
1202 | <xsl:text>schema-attribute</xsl:text> | 1223 | <xsl:text>schema-attribute</xsl:text> |
1203 | <xsl:value-of select="$LPAREN"/> | 1224 | <xsl:value-of select="$LPAREN"/> |
1204 | <xsl:call-template name="renderEQName"/> | 1225 | <xsl:call-template name="renderEQName"/> |
1205 | <xsl:value-of select="$RPAREN"/> | 1226 | <xsl:value-of select="$RPAREN"/> |
1206 | </xsl:template> | 1227 | </xsl:template> |
1207 | 1228 | ||
1208 | 1229 | ||
1209 | <!-- anyFunctionTest, part of higher-order functions --> | 1230 | <!-- anyFunctionTest, part of higher-order functions --> |
1210 | <xsl:template match="xqx:anyFunctionTest"> | 1231 | <xsl:template match="xqx:anyFunctionTest"> |
1211 | <xsl:apply-templates select="xqx:annotation"/> | 1232 | <xsl:apply-templates select="xqx:annotation"/> |
1212 | <xsl:text> function(*)</xsl:text> | 1233 | <xsl:text> function(*)</xsl:text> |
1213 | </xsl:template> | 1234 | </xsl:template> |
1214 | 1235 | ||
1215 | 1236 | ||
1216 | <!-- typedFunctionTest, part of higher-order functions --> | 1237 | <!-- typedFunctionTest, part of higher-order functions --> |
1217 | <xsl:template match="xqx:typedFunctionTest"> | 1238 | <xsl:template match="xqx:typedFunctionTest"> |
1218 | <xsl:apply-templates select="xqx:annotation"/> | 1239 | <xsl:apply-templates select="xqx:annotation"/> |
1219 | <xsl:text> function</xsl:text> | 1240 | <xsl:text> function</xsl:text> |
1220 | <xsl:apply-templates select="xqx:paramTypeList"/> | 1241 | <xsl:apply-templates select="xqx:paramTypeList"/> |
1221 | <xsl:text> as </xsl:text> | 1242 | <xsl:text> as </xsl:text> |
1222 | <xsl:apply-templates select="xqx:sequenceType"/> | 1243 | <xsl:apply-templates select="xqx:sequenceType"/> |
1223 | </xsl:template> | 1244 | </xsl:template> |
1224 | 1245 | ||
1225 | 1246 | ||
1226 | <xsl:template match="xqx:paramTypeList"> | 1247 | <xsl:template match="xqx:paramTypeList"> |
1227 | <xsl:call-template name="parenthesizedList"/> | 1248 | <xsl:call-template name="parenthesizedList"/> |
1228 | </xsl:template> | 1249 | </xsl:template> |
1229 | 1250 | ||
1230 | 1251 | ||
1231 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-11/JM For new MapTest --> | 1252 | ]]><phrase diff="add" at="2014-07-14"><![CDATA[<!-- 2014-07-11/JM For new MapTest --> |
1232 | <xsl:template match="xqx:anyMapTest"> | 1253 | <xsl:template match="xqx:anyMapTest"> |
1233 | <xsl:text> map(*)</xsl:text> | 1254 | <xsl:text> map(*)</xsl:text> |
1234 | </xsl:template> | 1255 | </xsl:template> |
1235 | 1256 | ||
1236 | 1257 | ||
1237 | <!-- 2014-07-11/JM For new MapTest --> | 1258 | <!-- 2014-07-11/JM For new MapTest --> |
1238 | <xsl:template match="xqx:typedMapTest"> | 1259 | <xsl:template match="xqx:typedMapTest"> |
1239 | <xsl:text> map(</xsl:text> | 1260 | <xsl:text> map(</xsl:text> |
1240 | <xsl:apply-templates select="xqx:atomicType"/> | 1261 | <xsl:apply-templates select="xqx:atomicType"/> |
1241 | <xsl:text>, </xsl:text> | 1262 | <xsl:text>, </xsl:text> |
1242 | <xsl:apply-templates select="xqx:sequenceType"/> | 1263 | <xsl:apply-templates select="xqx:sequenceType"/> |
1243 | <xsl:text>) </xsl:text> | 1264 | <xsl:text>) </xsl:text> |
1244 | </xsl:template> | 1265 | </xsl:template> |
1245 | 1266 | ||
1246 | 1267 | ||
1247 | <!-- 2014-07-13/JM For new stepExpr alternative lookup (formerly mapLookup) --> | 1268 | <!-- 2014-07-13/JM For new stepExpr alternative lookup (formerly mapLookup) --> |
1248 | <xsl:template match="xqx:lookup"> | 1269 | <xsl:template match="xqx:lookup"> |
1249 | <xsl:text> ?</xsl:text> | 1270 | <xsl:text> ?</xsl:text> |
1250 | <xsl:apply-templates/> | 1271 | <xsl:apply-templates/> |
1251 | </xsl:template> | 1272 | </xsl:template> |
1252 | 1273 | ||
1253 | 1274 | ||
1254 | <!-- 2014-07-11/JM For new ArrayTest --> | 1275 | <!-- 2014-07-11/JM For new ArrayTest --> |
1255 | <xsl:template match="xqx:anyArrayTest"> | 1276 | <xsl:template match="xqx:anyArrayTest"> |
1256 | <xsl:text> array(*)</xsl:text> | 1277 | <xsl:text> array(*)</xsl:text> |
1257 | </xsl:template> | 1278 | </xsl:template> |
1258 | 1279 | ||
1259 | 1280 | ||
1260 | <!-- 2014-07-11/JM For new ArrayTest --> | 1281 | <!-- 2014-07-11/JM For new ArrayTest --> |
1261 | <xsl:template match="xqx:typedArrayTest"> | 1282 | <xsl:template match="xqx:typedArrayTest"> |
1262 | <xsl:text> array(</xsl:text> | 1283 | <xsl:text> array(</xsl:text> |
1263 | <xsl:apply-templates select="xqx:sequenceType"/> | 1284 | <xsl:apply-templates select="xqx:sequenceType"/> |
1264 | <xsl:text>) </xsl:text> | 1285 | <xsl:text>) </xsl:text> |
1265 | </xsl:template> | 1286 | </xsl:template> |
1266 | 1287 | ||
1267 | 1288 | ||
1268 | ]]></phrase><![CDATA[ <!-- parenthesizedItemType, part of higher-order functions --> | 1289 | ]]></phrase><![CDATA[ <!-- parenthesizedItemType, part of higher-order functions --> |
1269 | <xsl:template match="xqx:parenthesizedItemType"> | 1290 | <xsl:template match="xqx:parenthesizedItemType"> |
1270 | <xsl:text> ( </xsl:text> | 1291 | <xsl:text> ( </xsl:text> |
1271 | <xsl:apply-templates/> | 1292 | <xsl:apply-templates/> |
1272 | <xsl:text> ) </xsl:text> | 1293 | <xsl:text> ) </xsl:text> |
1273 | </xsl:template> | 1294 | </xsl:template> |
1274 | 1295 | ||
1275 | 1296 | ||
1276 | <xsl:template match="xqx:stepExpr"> | 1297 | <xsl:template match="xqx:stepExpr"> |
1277 | <xsl:if test="preceding-sibling::xqx:stepExpr"> | 1298 | <xsl:if test="preceding-sibling::xqx:stepExpr"> |
1278 | <xsl:value-of select="$SLASH"/> | 1299 | <xsl:value-of select="$SLASH"/> |
1279 | </xsl:if> | 1300 | </xsl:if> |
1280 | <xsl:apply-templates select="*"/> | 1301 | <xsl:apply-templates select="*"/> |
1281 | </xsl:template> | 1302 | </xsl:template> |
1282 | 1303 | ||
1283 | 1304 | ||
1284 | <xsl:template match="xqx:filterExpr"> | 1305 | <xsl:template match="xqx:filterExpr"> |
1285 | <xsl:apply-templates/> | 1306 | <xsl:apply-templates/> |
1286 | </xsl:template> | 1307 | </xsl:template> |
1287 | 1308 | ||
1288 | 1309 | ||
1289 | <!-- part of higher-order functions --> | 1310 | <!-- part of higher-order functions --> |
1290 | <xsl:template match="xqx:namedFunctionRef"> | 1311 | <xsl:template match="xqx:namedFunctionRef"> |
1291 | <xsl:if test="(xqx:functionName = 'node' or | 1312 | <xsl:if test="(xqx:functionName = 'node' or |
1292 | xqx:functionName = 'document-node' or | 1313 | xqx:functionName = 'document-node' or |
1293 | xqx:functionName = 'element' or | 1314 | xqx:functionName = 'element' or |
1294 | xqx:functionName = 'attribute' or | 1315 | xqx:functionName = 'attribute' or |
1295 | xqx:functionName = 'schema-element' or | 1316 | xqx:functionName = 'schema-element' or |
1296 | xqx:functionName = 'schema-attribute' or | 1317 | xqx:functionName = 'schema-attribute' or |
1297 | xqx:functionName = 'processing-instruction' or | 1318 | xqx:functionName = 'processing-instruction' or |
1298 | xqx:functionName = 'comment' or | 1319 | xqx:functionName = 'comment' or |
1299 | xqx:functionName = 'text' or | 1320 | xqx:functionName = 'text' or |
1300 | xqx:functionName = 'function' or | 1321 | xqx:functionName = 'function' or |
1301 | xqx:functionName = 'namespace-node' or | 1322 | xqx:functionName = 'namespace-node' or |
1302 | xqx:functionName = 'item' or | 1323 | xqx:functionName = 'item' or |
1303 | xqx:functionName = 'if' or | 1324 | xqx:functionName = 'if' or |
1304 | xqx:functionName = 'switch' or | 1325 | xqx:functionName = 'switch' or |
1305 | xqx:functionName = 'typeswitch' or | 1326 | xqx:functionName = 'typeswitch' or |
1306 | xqx:functionName = 'empty-sequence') and | 1327 | xqx:functionName = 'empty-sequence') and |
1307 | ((not(@xqx:prefix) and not(@xqx:URI)) or | 1328 | ((not(@xqx:prefix) and not(@xqx:URI)) or |
1308 | (@xqx:prefix and @xqx:prefix = '') or | 1329 | (@xqx:prefix and @xqx:prefix = '') or |
1309 | (@xqx:URI and @xqx:URI = ''))"> | 1330 | (@xqx:URI and @xqx:URI = ''))"> |
1310 | <xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable> | 1331 | <xsl:variable name="message"><xsl:text>Incorrect XQueryX: function calls must not use unqualified "reserved" name "</xsl:text><xsl:value-of select="xqx:functionName"/><xsl:text>"</xsl:text></xsl:variable> |
1311 | <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message> | 1332 | <xsl:message terminate="yes"><xsl:value-of select="$message"/></xsl:message> |
1312 | </xsl:if> | 1333 | </xsl:if> |
1313 | <xsl:apply-templates select="xqx:functionName"/> | 1334 | <xsl:apply-templates select="xqx:functionName"/> |
1314 | <xsl:text>#</xsl:text> | 1335 | <xsl:text>#</xsl:text> |
1315 | <xsl:apply-templates select="xqx:integerConstantExpr"/> | 1336 | <xsl:apply-templates select="xqx:integerConstantExpr"/> |
1316 | </xsl:template> | 1337 | </xsl:template> |
1317 | 1338 | ||
1318 | <!-- part of higher-order functions --> | 1339 | <!-- part of higher-order functions --> |
1319 | <xsl:template match="xqx:inlineFunctionExpr"> | 1340 | <xsl:template match="xqx:inlineFunctionExpr"> |
1320 | <xsl:apply-templates select="xqx:annotation"/> | 1341 | <xsl:apply-templates select="xqx:annotation"/> |
1321 | <xsl:text> function </xsl:text> | 1342 | <xsl:text> function </xsl:text> |
1322 | <xsl:apply-templates select="xqx:paramList"/> | 1343 | <xsl:apply-templates select="xqx:paramList"/> |
1323 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 1344 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
1324 | <xsl:apply-templates select="xqx:functionBody"/> | 1345 | <xsl:apply-templates select="xqx:functionBody"/> |
1325 | </xsl:template> | 1346 | </xsl:template> |
1326 | 1347 | ||
1327 | <xsl:template match="xqx:pathExpr"> | 1348 | <xsl:template match="xqx:pathExpr"> |
1328 | <xsl:apply-templates select="xqx:rootExpr | xqx:stepExpr"/> | 1349 | <xsl:apply-templates select="xqx:rootExpr | xqx:stepExpr"/> |
1329 | </xsl:template> | 1350 | </xsl:template> |
1330 | 1351 | ||
1331 | 1352 | ||
1332 | <xsl:template match="xqx:attributeConstructor"> | 1353 | <xsl:template match="xqx:attributeConstructor"> |
1333 | <xsl:value-of select="$SPACE"/> | 1354 | <xsl:value-of select="$SPACE"/> |
1334 | <xsl:apply-templates select="xqx:attributeName"/> | 1355 | <xsl:apply-templates select="xqx:attributeName"/> |
1335 | <xsl:value-of select="$EQUAL"/> | 1356 | <xsl:value-of select="$EQUAL"/> |
1336 | <xsl:choose> | 1357 | <xsl:choose> |
1337 | <xsl:when test="xqx:attributeValue"> | 1358 | <xsl:when test="xqx:attributeValue"> |
1338 | <xsl:call-template name="globalReplace"> | 1359 | <xsl:call-template name="globalReplace"> |
1339 | <xsl:with-param name="stringToBeFixed"> | 1360 | <xsl:with-param name="stringToBeFixed"> |
1340 | <xsl:call-template name="globalReplace"> | 1361 | <xsl:call-template name="globalReplace"> |
1341 | <xsl:with-param name="stringToBeFixed"> | 1362 | <xsl:with-param name="stringToBeFixed"> |
1342 | <xsl:call-template name="quote"> | 1363 | <xsl:call-template name="quote"> |
1343 | <xsl:with-param name="item"> | 1364 | <xsl:with-param name="item"> |
1344 | <xsl:call-template name="globalReplace"> | 1365 | <xsl:call-template name="globalReplace"> |
1345 | <xsl:with-param name="stringToBeFixed"> | 1366 | <xsl:with-param name="stringToBeFixed"> |
1346 | <xsl:call-template name="globalReplace"> | 1367 | <xsl:call-template name="globalReplace"> |
1347 | <xsl:with-param name="stringToBeFixed"> | 1368 | <xsl:with-param name="stringToBeFixed"> |
1348 | <xsl:value-of select="xqx:attributeValue"/> | 1369 | <xsl:value-of select="xqx:attributeValue"/> |
1349 | </xsl:with-param> | 1370 | </xsl:with-param> |
1350 | <xsl:with-param name="toBeReplaced"><xsl:text>{</xsl:text></xsl:with-param> | 1371 | <xsl:with-param name="toBeReplaced"><xsl:text>{</xsl:text></xsl:with-param> |
1351 | <xsl:with-param name="replacement"><xsl:text>{{</xsl:text></xsl:with-param> | 1372 | <xsl:with-param name="replacement"><xsl:text>{{</xsl:text></xsl:with-param> |
1352 | </xsl:call-template> | 1373 | </xsl:call-template> |
1353 | </xsl:with-param> | 1374 | </xsl:with-param> |
1354 | <xsl:with-param name="toBeReplaced"><xsl:text>}</xsl:text></xsl:with-param> | 1375 | <xsl:with-param name="toBeReplaced"><xsl:text>}</xsl:text></xsl:with-param> |
1355 | <xsl:with-param name="replacement"><xsl:text>}}</xsl:text></xsl:with-param> | 1376 | <xsl:with-param name="replacement"><xsl:text>}}</xsl:text></xsl:with-param> |
1356 | </xsl:call-template> | 1377 | </xsl:call-template> |
1357 | </xsl:with-param> | 1378 | </xsl:with-param> |
1358 | </xsl:call-template> | 1379 | </xsl:call-template> |
1359 | </xsl:with-param> | 1380 | </xsl:with-param> |
1360 | <xsl:with-param name="toBeReplaced" select="'
'"/> | 1381 | <xsl:with-param name="toBeReplaced" select="'
'"/> |
1361 | <xsl:with-param name="replacement">&#xA;</xsl:with-param> | 1382 | <xsl:with-param name="replacement">&#xA;</xsl:with-param> |
1362 | </xsl:call-template> | 1383 | </xsl:call-template> |
1363 | </xsl:with-param> | 1384 | </xsl:with-param> |
1364 | <xsl:with-param name="toBeReplaced" select="'	'"/> | 1385 | <xsl:with-param name="toBeReplaced" select="'	'"/> |
1365 | <xsl:with-param name="replacement">&#x9;</xsl:with-param> | 1386 | <xsl:with-param name="replacement">&#x9;</xsl:with-param> |
1366 | </xsl:call-template> | 1387 | </xsl:call-template> |
1367 | </xsl:when> | 1388 | </xsl:when> |
1368 | <xsl:otherwise> | 1389 | <xsl:otherwise> |
1369 | <xsl:value-of select="$DOUBLEQUOTE"/> | 1390 | <xsl:value-of select="$DOUBLEQUOTE"/> |
1370 | <xsl:for-each select="./xqx:attributeValueExpr/xqx:*"> | 1391 | <xsl:for-each select="./xqx:attributeValueExpr/xqx:*"> |
1371 | <xsl:value-of select="$LBRACE"/> | 1392 | <xsl:value-of select="$LBRACE"/> |
1372 | <xsl:apply-templates select="."/> | 1393 | <xsl:apply-templates select="."/> |
1373 | <xsl:value-of select="$RBRACE"/> | 1394 | <xsl:value-of select="$RBRACE"/> |
1374 | </xsl:for-each> | 1395 | </xsl:for-each> |
1375 | <xsl:value-of select="$DOUBLEQUOTE"/> | 1396 | <xsl:value-of select="$DOUBLEQUOTE"/> |
1376 | </xsl:otherwise> | 1397 | </xsl:otherwise> |
1377 | </xsl:choose> | 1398 | </xsl:choose> |
1378 | </xsl:template> | 1399 | </xsl:template> |
1379 | 1400 | ||
1380 | 1401 | ||
1381 | <xsl:template match="xqx:namespaceDeclaration"> | 1402 | <xsl:template match="xqx:namespaceDeclaration"> |
1382 | <xsl:text> xmlns</xsl:text> | 1403 | <xsl:text> xmlns</xsl:text> |
1383 | <xsl:if test="xqx:prefix"> | 1404 | <xsl:if test="xqx:prefix"> |
1384 | <xsl:text>:</xsl:text> | 1405 | <xsl:text>:</xsl:text> |
1385 | <xsl:value-of select="xqx:prefix"/> | 1406 | <xsl:value-of select="xqx:prefix"/> |
1386 | </xsl:if> | 1407 | </xsl:if> |
1387 | <xsl:value-of select="$EQUAL"/> | 1408 | <xsl:value-of select="$EQUAL"/> |
1388 | <xsl:call-template name="quote"> | 1409 | <xsl:call-template name="quote"> |
1389 | <xsl:with-param name="item"> | 1410 | <xsl:with-param name="item"> |
1390 | <xsl:call-template name="globalReplace"> | 1411 | <xsl:call-template name="globalReplace"> |
1391 | <xsl:with-param name="stringToBeFixed"> | 1412 | <xsl:with-param name="stringToBeFixed"> |
1392 | <xsl:call-template name="globalReplace"> | 1413 | <xsl:call-template name="globalReplace"> |
1393 | <xsl:with-param name="stringToBeFixed"> | 1414 | <xsl:with-param name="stringToBeFixed"> |
1394 | <xsl:value-of select="xqx:uri"/> | 1415 | <xsl:value-of select="xqx:uri"/> |
1395 | </xsl:with-param> | 1416 | </xsl:with-param> |
1396 | <xsl:with-param name="toBeReplaced"> | 1417 | <xsl:with-param name="toBeReplaced"> |
1397 | <xsl:text>{</xsl:text> | 1418 | <xsl:text>{</xsl:text> |
1398 | </xsl:with-param> | 1419 | </xsl:with-param> |
1399 | <xsl:with-param name="replacement"> | 1420 | <xsl:with-param name="replacement"> |
1400 | <xsl:text>{{</xsl:text> | 1421 | <xsl:text>{{</xsl:text> |
1401 | </xsl:with-param> | 1422 | </xsl:with-param> |
1402 | </xsl:call-template> | 1423 | </xsl:call-template> |
1403 | </xsl:with-param> | 1424 | </xsl:with-param> |
1404 | <xsl:with-param name="toBeReplaced"> | 1425 | <xsl:with-param name="toBeReplaced"> |
1405 | <xsl:text>}</xsl:text> | 1426 | <xsl:text>}</xsl:text> |
1406 | </xsl:with-param> | 1427 | </xsl:with-param> |
1407 | <xsl:with-param name="replacement"> | 1428 | <xsl:with-param name="replacement"> |
1408 | <xsl:text>}}</xsl:text> | 1429 | <xsl:text>}}</xsl:text> |
1409 | </xsl:with-param> | 1430 | </xsl:with-param> |
1410 | </xsl:call-template> | 1431 | </xsl:call-template> |
1411 | </xsl:with-param> | 1432 | </xsl:with-param> |
1412 | </xsl:call-template> | 1433 | </xsl:call-template> |
1413 | </xsl:template> | 1434 | </xsl:template> |
1414 | 1435 | ||
1415 | 1436 | ||
1416 | <xsl:template match="xqx:attributeList"> | 1437 | <xsl:template match="xqx:attributeList"> |
1417 | <xsl:apply-templates select="*"/> | 1438 | <xsl:apply-templates select="*"/> |
1418 | </xsl:template> | 1439 | </xsl:template> |
1419 | 1440 | ||
1420 | 1441 | ||
1421 | <xsl:template match="xqx:elementContent"> | 1442 | <xsl:template match="xqx:elementContent"> |
1422 | <xsl:for-each select="*"> | 1443 | <xsl:for-each select="*"> |
1423 | <xsl:if test="not(self::xqx:elementConstructor)"> | 1444 | <xsl:if test="not(self::xqx:elementConstructor)"> |
1424 | <xsl:value-of select="$SPACE"/> | 1445 | <xsl:value-of select="$SPACE"/> |
1425 | <xsl:value-of select="$LBRACE"/> | 1446 | <xsl:value-of select="$LBRACE"/> |
1426 | </xsl:if> | 1447 | </xsl:if> |
1427 | <xsl:apply-templates select="."/> | 1448 | <xsl:apply-templates select="."/> |
1428 | <xsl:if test="not(self::xqx:elementConstructor)"> | 1449 | <xsl:if test="not(self::xqx:elementConstructor)"> |
1429 | <xsl:value-of select="$SPACE"/> | 1450 | <xsl:value-of select="$SPACE"/> |
1430 | <xsl:value-of select="$RBRACE"/> | 1451 | <xsl:value-of select="$RBRACE"/> |
1431 | </xsl:if> | 1452 | </xsl:if> |
1432 | </xsl:for-each> | 1453 | </xsl:for-each> |
1433 | </xsl:template> | 1454 | </xsl:template> |
1434 | 1455 | ||
1435 | 1456 | ||
1436 | <xsl:template match="xqx:elementConstructor"> | 1457 | <xsl:template match="xqx:elementConstructor"> |
1437 | <xsl:value-of select="$LESSTHAN"/> | 1458 | <xsl:value-of select="$LESSTHAN"/> |
1438 | <xsl:apply-templates select="xqx:tagName"/> | 1459 | <xsl:apply-templates select="xqx:tagName"/> |
1439 | <xsl:apply-templates select="xqx:attributeList"/> | 1460 | <xsl:apply-templates select="xqx:attributeList"/> |
1440 | <xsl:value-of select="$GREATERTHAN"/> | 1461 | <xsl:value-of select="$GREATERTHAN"/> |
1441 | <xsl:apply-templates select="xqx:elementContent"/> | 1462 | <xsl:apply-templates select="xqx:elementContent"/> |
1442 | <xsl:value-of select="$LESSTHAN"/> | 1463 | <xsl:value-of select="$LESSTHAN"/> |
1443 | <xsl:value-of select="$SLASH"/> | 1464 | <xsl:value-of select="$SLASH"/> |
1444 | <xsl:apply-templates select="xqx:tagName"/> | 1465 | <xsl:apply-templates select="xqx:tagName"/> |
1445 | <xsl:value-of select="$GREATERTHAN"/> | 1466 | <xsl:value-of select="$GREATERTHAN"/> |
1446 | </xsl:template> | 1467 | </xsl:template> |
1447 | 1468 | ||
1448 | 1469 | ||
1449 | <xsl:template match="xqx:tagNameExpr"> | 1470 | <xsl:template match="xqx:tagNameExpr"> |
1450 | <xsl:value-of select="$LBRACE"/> | 1471 | <xsl:value-of select="$LBRACE"/> |
1451 | <xsl:apply-templates select="*"/> | 1472 | <xsl:apply-templates select="*"/> |
1452 | <xsl:value-of select="$RBRACE"/> | 1473 | <xsl:value-of select="$RBRACE"/> |
1453 | </xsl:template> | 1474 | </xsl:template> |
1454 | 1475 | ||
1455 | 1476 | ||
1456 | <xsl:template match="xqx:computedElementConstructor"> | 1477 | <xsl:template match="xqx:computedElementConstructor"> |
1457 | <xsl:text> element </xsl:text> | 1478 | <xsl:text> element </xsl:text> |
1458 | <xsl:apply-templates select="xqx:tagName"/> | 1479 | <xsl:apply-templates select="xqx:tagName"/> |
1459 | <xsl:apply-templates select="xqx:tagNameExpr"/> | 1480 | <xsl:apply-templates select="xqx:tagNameExpr"/> |
1460 | <xsl:value-of select="$SPACE"/> | 1481 | <xsl:value-of select="$SPACE"/> |
1461 | <xsl:value-of select="$LBRACE"/> | 1482 | <xsl:value-of select="$LBRACE"/> |
1462 | <xsl:value-of select="$SPACE"/> | 1483 | <xsl:value-of select="$SPACE"/> |
1463 | <xsl:apply-templates select="xqx:contentExpr"/> | 1484 | <xsl:apply-templates select="xqx:contentExpr"/> |
1464 | <xsl:value-of select="$SPACE"/> | 1485 | <xsl:value-of select="$SPACE"/> |
1465 | <xsl:value-of select="$RBRACE"/> | 1486 | <xsl:value-of select="$RBRACE"/> |
1466 | </xsl:template> | 1487 | </xsl:template> |
1467 | 1488 | ||
1468 | 1489 | ||
1469 | <xsl:template match="xqx:contentExpr"> | 1490 | <xsl:template match="xqx:contentExpr"> |
1470 | <xsl:apply-templates/> | 1491 | <xsl:apply-templates/> |
1471 | </xsl:template> | 1492 | </xsl:template> |
1472 | 1493 | ||
1473 | <xsl:template match="xqx:computedAttributeConstructor"> | 1494 | <xsl:template match="xqx:computedAttributeConstructor"> |
1474 | <xsl:text> attribute </xsl:text> | 1495 | <xsl:text> attribute </xsl:text> |
1475 | <xsl:apply-templates select="xqx:tagName"/> | 1496 | <xsl:apply-templates select="xqx:tagName"/> |
1476 | <xsl:apply-templates select="xqx:tagNameExpr"/> | 1497 | <xsl:apply-templates select="xqx:tagNameExpr"/> |
1477 | <xsl:value-of select="$SPACE"/> | 1498 | <xsl:value-of select="$SPACE"/> |
1478 | <xsl:value-of select="$LBRACE"/> | 1499 | <xsl:value-of select="$LBRACE"/> |
1479 | <xsl:apply-templates select="xqx:valueExpr"/> | 1500 | <xsl:apply-templates select="xqx:valueExpr"/> |
1480 | <xsl:value-of select="$SPACE"/> | 1501 | <xsl:value-of select="$SPACE"/> |
1481 | <xsl:value-of select="$RBRACE"/> | 1502 | <xsl:value-of select="$RBRACE"/> |
1482 | </xsl:template> | 1503 | </xsl:template> |
1483 | 1504 | ||
1484 | 1505 | ||
1485 | <xsl:template match="xqx:computedDocumentConstructor"> | 1506 | <xsl:template match="xqx:computedDocumentConstructor"> |
1486 | <xsl:text> document {</xsl:text> | 1507 | <xsl:text> document {</xsl:text> |
1487 | <xsl:apply-templates select="*"/> | 1508 | <xsl:apply-templates select="*"/> |
1488 | <xsl:text> }</xsl:text> | 1509 | <xsl:text> }</xsl:text> |
1489 | </xsl:template> | 1510 | </xsl:template> |
1490 | 1511 | ||
1491 | 1512 | ||
1492 | <xsl:template match="xqx:computedTextConstructor"> | 1513 | <xsl:template match="xqx:computedTextConstructor"> |
1493 | <xsl:text> text</xsl:text> | 1514 | <xsl:text> text</xsl:text> |
1494 | <xsl:value-of select="$SPACE"/> | 1515 | <xsl:value-of select="$SPACE"/> |
1495 | <xsl:value-of select="$LBRACE"/> | 1516 | <xsl:value-of select="$LBRACE"/> |
1496 | <xsl:apply-templates select="*"/> | 1517 | <xsl:apply-templates select="*"/> |
1497 | <xsl:value-of select="$SPACE"/> | 1518 | <xsl:value-of select="$SPACE"/> |
1498 | <xsl:value-of select="$RBRACE"/> | 1519 | <xsl:value-of select="$RBRACE"/> |
1499 | </xsl:template> | 1520 | </xsl:template> |
1500 | 1521 | ||
1501 | 1522 | ||
1502 | <xsl:template match="xqx:computedCommentConstructor"> | 1523 | <xsl:template match="xqx:computedCommentConstructor"> |
1503 | <xsl:text> comment</xsl:text> | 1524 | <xsl:text> comment</xsl:text> |
1504 | <xsl:value-of select="$LBRACE"/> | 1525 | <xsl:value-of select="$LBRACE"/> |
1505 | <xsl:apply-templates select="*"/> | 1526 | <xsl:apply-templates select="*"/> |
1506 | <xsl:value-of select="$RBRACE"/> | 1527 | <xsl:value-of select="$RBRACE"/> |
1507 | </xsl:template> | 1528 | </xsl:template> |
1508 | 1529 | ||
1509 | 1530 | ||
1510 | <xsl:template match="xqx:computedNamespaceConstructor"> | 1531 | <xsl:template match="xqx:computedNamespaceConstructor"> |
1511 | <xsl:text> namespace </xsl:text> | 1532 | <xsl:text> namespace </xsl:text> |
1512 | <xsl:choose> | 1533 | <xsl:choose> |
1513 | <xsl:when test="xqx:prefix"> | 1534 | <xsl:when test="xqx:prefix"> |
1514 | <xsl:value-of select="xqx:prefix"/> | 1535 | <xsl:value-of select="xqx:prefix"/> |
1515 | </xsl:when> | 1536 | </xsl:when> |
1516 | <xsl:otherwise> | 1537 | <xsl:otherwise> |
1517 | <xsl:value-of select="$LBRACE"/> | 1538 | <xsl:value-of select="$LBRACE"/> |
1518 | <xsl:apply-templates select="xqx:prefixExpr"/> | 1539 | <xsl:apply-templates select="xqx:prefixExpr"/> |
1519 | <xsl:value-of select="$RBRACE"/> | 1540 | <xsl:value-of select="$RBRACE"/> |
1520 | </xsl:otherwise> | 1541 | </xsl:otherwise> |
1521 | </xsl:choose> | 1542 | </xsl:choose> |
1522 | <xsl:value-of select="$SPACE"/> | 1543 | <xsl:value-of select="$SPACE"/> |
1523 | <xsl:value-of select="$LBRACE"/> | 1544 | <xsl:value-of select="$LBRACE"/> |
1524 | <xsl:apply-templates select="xqx:URIExpr"/> | 1545 | <xsl:apply-templates select="xqx:URIExpr"/> |
1525 | <xsl:value-of select="$RBRACE"/> | 1546 | <xsl:value-of select="$RBRACE"/> |
1526 | </xsl:template> | 1547 | </xsl:template> |
1527 | 1548 | ||
1528 | 1549 | ||
1529 | <xsl:template match="xqx:piTargetExpr"> | 1550 | <xsl:template match="xqx:piTargetExpr"> |
1530 | <xsl:value-of select="$LBRACE"/> | 1551 | <xsl:value-of select="$LBRACE"/> |
1531 | <xsl:apply-templates select="*"/> | 1552 | <xsl:apply-templates select="*"/> |
1532 | <xsl:value-of select="$RBRACE"/> | 1553 | <xsl:value-of select="$RBRACE"/> |
1533 | </xsl:template> | 1554 | </xsl:template> |
1534 | 1555 | ||
1535 | 1556 | ||
1536 | <xsl:template match="xqx:piValueExpr"> | 1557 | <xsl:template match="xqx:piValueExpr"> |
1537 | <xsl:apply-templates select="*"/> | 1558 | <xsl:apply-templates select="*"/> |
1538 | </xsl:template> | 1559 | </xsl:template> |
1539 | 1560 | ||
1540 | 1561 | ||
1541 | <xsl:template match="xqx:computedPIConstructor"> | 1562 | <xsl:template match="xqx:computedPIConstructor"> |
1542 | <xsl:text> processing-instruction </xsl:text> | 1563 | <xsl:text> processing-instruction </xsl:text> |
1543 | <xsl:value-of select="xqx:piTarget"/> | 1564 | <xsl:value-of select="xqx:piTarget"/> |
1544 | <xsl:apply-templates select="xqx:piTargetExpr"/> | 1565 | <xsl:apply-templates select="xqx:piTargetExpr"/> |
1545 | <xsl:value-of select="$LBRACE"/> | 1566 | <xsl:value-of select="$LBRACE"/> |
1546 | <xsl:apply-templates select="xqx:piValueExpr"/> | 1567 | <xsl:apply-templates select="xqx:piValueExpr"/> |
1547 | <xsl:value-of select="$RBRACE"/> | 1568 | <xsl:value-of select="$RBRACE"/> |
1548 | </xsl:template> | 1569 | </xsl:template> |
1549 | 1570 | ||
1550 | 1571 | ||
1551 | <xsl:template match="xqx:unorderedExpr"> | 1572 | <xsl:template match="xqx:unorderedExpr"> |
1552 | <xsl:text> unordered</xsl:text> | 1573 | <xsl:text> unordered</xsl:text> |
1553 | <xsl:value-of select="$LBRACE"/> | 1574 | <xsl:value-of select="$LBRACE"/> |
1554 | <xsl:text> </xsl:text> | 1575 | <xsl:text> </xsl:text> |
1555 | <xsl:apply-templates select="*"/> | 1576 | <xsl:apply-templates select="*"/> |
1556 | <xsl:text> </xsl:text> | 1577 | <xsl:text> </xsl:text> |
1557 | <xsl:value-of select="$RBRACE"/> | 1578 | <xsl:value-of select="$RBRACE"/> |
1558 | </xsl:template> | 1579 | </xsl:template> |
1559 | 1580 | ||
1560 | 1581 | ||
1561 | <xsl:template match="xqx:orderedExpr"> | 1582 | <xsl:template match="xqx:orderedExpr"> |
1562 | <xsl:text> ordered</xsl:text> | 1583 | <xsl:text> ordered</xsl:text> |
1563 | <xsl:value-of select="$LBRACE"/> | 1584 | <xsl:value-of select="$LBRACE"/> |
1564 | <xsl:text> </xsl:text> | 1585 | <xsl:text> </xsl:text> |
1565 | <xsl:apply-templates select="*"/> | 1586 | <xsl:apply-templates select="*"/> |
1566 | <xsl:text> </xsl:text> | 1587 | <xsl:text> </xsl:text> |
1567 | <xsl:value-of select="$RBRACE"/> | 1588 | <xsl:value-of select="$RBRACE"/> |
1568 | </xsl:template> | 1589 | </xsl:template> |
1569 | 1590 | ||
1570 | 1591 | ||
1571 | <xsl:template match="xqx:versionDecl"> | 1592 | <xsl:template match="xqx:versionDecl"> |
1572 | <xsl:text>xquery </xsl:text> | 1593 | <xsl:text>xquery </xsl:text> |
1573 | <xsl:if test="xqx:version"> | 1594 | <xsl:if test="xqx:version"> |
1574 | <xsl:text>version </xsl:text> | 1595 | <xsl:text>version </xsl:text> |
1575 | <xsl:call-template name="quote"> | 1596 | <xsl:call-template name="quote"> |
1576 | <xsl:with-param name="item" select="xqx:version"/> | 1597 | <xsl:with-param name="item" select="xqx:version"/> |
1577 | </xsl:call-template> | 1598 | </xsl:call-template> |
1578 | </xsl:if> | 1599 | </xsl:if> |
1579 | <xsl:if test="xqx:encoding and xqx:version"> | 1600 | <xsl:if test="xqx:encoding and xqx:version"> |
1580 | <xsl:value-of select="$SPACE"/> | 1601 | <xsl:value-of select="$SPACE"/> |
1581 | </xsl:if> | 1602 | </xsl:if> |
1582 | <xsl:if test="xqx:encoding"> | 1603 | <xsl:if test="xqx:encoding"> |
1583 | <xsl:text>encoding </xsl:text> | 1604 | <xsl:text>encoding </xsl:text> |
1584 | <xsl:call-template name="quote"> | 1605 | <xsl:call-template name="quote"> |
1585 | <xsl:with-param name="item" select="xqx:encoding"/> | 1606 | <xsl:with-param name="item" select="xqx:encoding"/> |
1586 | </xsl:call-template> | 1607 | </xsl:call-template> |
1587 | </xsl:if> | 1608 | </xsl:if> |
1588 | <xsl:value-of select="$SEPARATOR"/> | 1609 | <xsl:value-of select="$SEPARATOR"/> |
1589 | <xsl:value-of select="$NEWLINE"/> | 1610 | <xsl:value-of select="$NEWLINE"/> |
1590 | </xsl:template> | 1611 | </xsl:template> |
1591 | 1612 | ||
1592 | 1613 | ||
1593 | <xsl:template match="xqx:namespaceDecl"> | 1614 | <xsl:template match="xqx:namespaceDecl"> |
1594 | <xsl:text>declare namespace </xsl:text> | 1615 | <xsl:text>declare namespace </xsl:text> |
1595 | <xsl:value-of select="xqx:prefix"/> | 1616 | <xsl:value-of select="xqx:prefix"/> |
1596 | <xsl:value-of select="$EQUAL"/> | 1617 | <xsl:value-of select="$EQUAL"/> |
1597 | <xsl:call-template name="quote"> | 1618 | <xsl:call-template name="quote"> |
1598 | <xsl:with-param name="item" select="xqx:uri"/> | 1619 | <xsl:with-param name="item" select="xqx:uri"/> |
1599 | </xsl:call-template> | 1620 | </xsl:call-template> |
1600 | </xsl:template> | 1621 | </xsl:template> |
1601 | 1622 | ||
1602 | 1623 | ||
1603 | <xsl:template match="xqx:defaultNamespaceDecl"> | 1624 | <xsl:template match="xqx:defaultNamespaceDecl"> |
1604 | <xsl:text>declare default </xsl:text> | 1625 | <xsl:text>declare default </xsl:text> |
1605 | <xsl:value-of select="xqx:defaultNamespaceCategory"/> | 1626 | <xsl:value-of select="xqx:defaultNamespaceCategory"/> |
1606 | <xsl:text> namespace </xsl:text> | 1627 | <xsl:text> namespace </xsl:text> |
1607 | <xsl:call-template name="quote"> | 1628 | <xsl:call-template name="quote"> |
1608 | <xsl:with-param name="item" select="xqx:uri"/> | 1629 | <xsl:with-param name="item" select="xqx:uri"/> |
1609 | </xsl:call-template> | 1630 | </xsl:call-template> |
1610 | </xsl:template> | 1631 | </xsl:template> |
1611 | 1632 | ||
1612 | 1633 | ||
1613 | <xsl:template match="xqx:boundarySpaceDecl"> | 1634 | <xsl:template match="xqx:boundarySpaceDecl"> |
1614 | <xsl:text>declare boundary-space </xsl:text> | 1635 | <xsl:text>declare boundary-space </xsl:text> |
1615 | <xsl:value-of select="."/> | 1636 | <xsl:value-of select="."/> |
1616 | </xsl:template> | 1637 | </xsl:template> |
1617 | 1638 | ||
1618 | 1639 | ||
1619 | <xsl:template match="xqx:defaultCollationDecl"> | 1640 | <xsl:template match="xqx:defaultCollationDecl"> |
1620 | <xsl:text>declare default collation </xsl:text> | 1641 | <xsl:text>declare default collation </xsl:text> |
1621 | <xsl:call-template name="quote"> | 1642 | <xsl:call-template name="quote"> |
1622 | <xsl:with-param name="item" select="."/> | 1643 | <xsl:with-param name="item" select="."/> |
1623 | </xsl:call-template> | 1644 | </xsl:call-template> |
1624 | </xsl:template> | 1645 | </xsl:template> |
1625 | 1646 | ||
1626 | 1647 | ||
1627 | <xsl:template match="xqx:baseUriDecl"> | 1648 | <xsl:template match="xqx:baseUriDecl"> |
1628 | <xsl:text>declare base-uri </xsl:text> | 1649 | <xsl:text>declare base-uri </xsl:text> |
1629 | <xsl:call-template name="quote"> | 1650 | <xsl:call-template name="quote"> |
1630 | <xsl:with-param name="item" select="."/> | 1651 | <xsl:with-param name="item" select="."/> |
1631 | </xsl:call-template> | 1652 | </xsl:call-template> |
1632 | </xsl:template> | 1653 | </xsl:template> |
1633 | 1654 | ||
1634 | <xsl:template match="xqx:constructionDecl"> | 1655 | <xsl:template match="xqx:constructionDecl"> |
1635 | <xsl:text>declare construction </xsl:text> | 1656 | <xsl:text>declare construction </xsl:text> |
1636 | <xsl:value-of select="."/> | 1657 | <xsl:value-of select="."/> |
1637 | </xsl:template> | 1658 | </xsl:template> |
1638 | 1659 | ||
1639 | 1660 | ||
1640 | <xsl:template match="xqx:orderingModeDecl"> | 1661 | <xsl:template match="xqx:orderingModeDecl"> |
1641 | <xsl:text>declare ordering </xsl:text> | 1662 | <xsl:text>declare ordering </xsl:text> |
1642 | <xsl:value-of select="."/> | 1663 | <xsl:value-of select="."/> |
1643 | </xsl:template> | 1664 | </xsl:template> |
1644 | 1665 | ||
1645 | 1666 | ||
1646 | <xsl:template match="xqx:emptyOrderingDecl"> | 1667 | <xsl:template match="xqx:emptyOrderingDecl"> |
1647 | <xsl:text>declare default order </xsl:text> | 1668 | <xsl:text>declare default order </xsl:text> |
1648 | <xsl:value-of select="."/> | 1669 | <xsl:value-of select="."/> |
1649 | </xsl:template> | 1670 | </xsl:template> |
1650 | 1671 | ||
1651 | 1672 | ||
1652 | <xsl:template match="xqx:copyNamespacesDecl"> | 1673 | <xsl:template match="xqx:copyNamespacesDecl"> |
1653 | <xsl:text>declare copy-namespaces </xsl:text> | 1674 | <xsl:text>declare copy-namespaces </xsl:text> |
1654 | <xsl:value-of select="xqx:preserveMode"/> | 1675 | <xsl:value-of select="xqx:preserveMode"/> |
1655 | <xsl:value-of select="$COMMA"/> | 1676 | <xsl:value-of select="$COMMA"/> |
1656 | <xsl:value-of select="xqx:inheritMode"/> | 1677 | <xsl:value-of select="xqx:inheritMode"/> |
1657 | </xsl:template> | 1678 | </xsl:template> |
1658 | 1679 | ||
1659 | 1680 | ||
1660 | <xsl:template match="xqx:optionDecl"> | 1681 | <xsl:template match="xqx:optionDecl"> |
1661 | <xsl:text>declare option </xsl:text> | 1682 | <xsl:text>declare option </xsl:text> |
1662 | <xsl:apply-templates select="xqx:optionName"/> | 1683 | <xsl:apply-templates select="xqx:optionName"/> |
1663 | <xsl:value-of select="$SPACE"/> | 1684 | <xsl:value-of select="$SPACE"/> |
1664 | <xsl:call-template name="quote"> | 1685 | <xsl:call-template name="quote"> |
1665 | <xsl:with-param name="item" select="xqx:optionContents"/> | 1686 | <xsl:with-param name="item" select="xqx:optionContents"/> |
1666 | </xsl:call-template> | 1687 | </xsl:call-template> |
1667 | </xsl:template> | 1688 | </xsl:template> |
1668 | 1689 | ||
1669 | 1690 | ||
1670 | <xsl:template match="xqx:decimalFormatDecl"> | 1691 | <xsl:template match="xqx:decimalFormatDecl"> |
1671 | <xsl:text>declare </xsl:text> | 1692 | <xsl:text>declare </xsl:text> |
1672 | <xsl:if test="not(xqx:decimalFormatName)"> | 1693 | <xsl:if test="not(xqx:decimalFormatName)"> |
1673 | <xsl:text>default </xsl:text> | 1694 | <xsl:text>default </xsl:text> |
1674 | </xsl:if> | 1695 | </xsl:if> |
1675 | <xsl:text>decimal-format </xsl:text> | 1696 | <xsl:text>decimal-format </xsl:text> |
1676 | <xsl:if test="xqx:decimalFormatName"> | 1697 | <xsl:if test="xqx:decimalFormatName"> |
1677 | <xsl:apply-templates select="xqx:decimalFormatName"/> | 1698 | <xsl:apply-templates select="xqx:decimalFormatName"/> |
1678 | <xsl:text> </xsl:text> | 1699 | <xsl:text> </xsl:text> |
1679 | </xsl:if> | 1700 | </xsl:if> |
1680 | <xsl:apply-templates select="xqx:decimalFormatParam"/> | 1701 | <xsl:apply-templates select="xqx:decimalFormatParam"/> |
1681 | </xsl:template> | 1702 | </xsl:template> |
1682 | 1703 | ||
1683 | 1704 | ||
1684 | <xsl:template match="xqx:decimalFormatParam"> | 1705 | <xsl:template match="xqx:decimalFormatParam"> |
1685 | <xsl:value-of select="xqx:decimalFormatParamName"/> | 1706 | <xsl:value-of select="xqx:decimalFormatParamName"/> |
1686 | <xsl:text> = </xsl:text> | 1707 | <xsl:text> = </xsl:text> |
1687 | <xsl:call-template name="quote"> | 1708 | <xsl:call-template name="quote"> |
1688 | <xsl:with-param name="item" select="xqx:decimalFormatParamValue"/> | 1709 | <xsl:with-param name="item" select="xqx:decimalFormatParamValue"/> |
1689 | </xsl:call-template> | 1710 | </xsl:call-template> |
1690 | <xsl:text> </xsl:text> | 1711 | <xsl:text> </xsl:text> |
1691 | </xsl:template> | 1712 | </xsl:template> |
1692 | 1713 | ||
1693 | 1714 | ||
1694 | <xsl:template match="xqx:voidSequenceType"> | 1715 | <xsl:template match="xqx:voidSequenceType"> |
1695 | <xsl:text>empty-sequence()</xsl:text> | 1716 | <xsl:text>empty-sequence()</xsl:text> |
1696 | </xsl:template> | 1717 | </xsl:template> |
1697 | 1718 | ||
1698 | 1719 | ||
1699 | <xsl:template match="xqx:occurrenceIndicator"> | 1720 | <xsl:template match="xqx:occurrenceIndicator"> |
1700 | <xsl:value-of select="."/> | 1721 | <xsl:value-of select="."/> |
1701 | </xsl:template> | 1722 | </xsl:template> |
1702 | 1723 | ||
1703 | 1724 | ||
1704 | <xsl:template match="xqx:anyItemType"> | 1725 | <xsl:template match="xqx:anyItemType"> |
1705 | <xsl:text>item()</xsl:text> | 1726 | <xsl:text>item()</xsl:text> |
1706 | </xsl:template> | 1727 | </xsl:template> |
1707 | 1728 | ||
1708 | 1729 | ||
1709 | <xsl:template match="xqx:sequenceType"> | 1730 | <xsl:template match="xqx:sequenceType"> |
1710 | <xsl:apply-templates select="*"/> | 1731 | <xsl:apply-templates select="*"/> |
1711 | </xsl:template> | 1732 | </xsl:template> |
1712 | 1733 | ||
1713 | 1734 | ||
1714 | <xsl:template match="xqx:sequenceTypeUnion"> | 1735 | <xsl:template match="xqx:sequenceTypeUnion"> |
1715 | <xsl:apply-templates select="xqx:sequenceType[1]"/> | 1736 | <xsl:apply-templates select="xqx:sequenceType[1]"/> |
1716 | <xsl:if test="count(xqx:sequenceType) > 1"> | 1737 | <xsl:if test="count(xqx:sequenceType) > 1"> |
1717 | <xsl:for-each select="xqx:sequenceType[position() > 1]"> | 1738 | <xsl:for-each select="xqx:sequenceType[position() > 1]"> |
1718 | <xsl:text> | </xsl:text> | 1739 | <xsl:text> | </xsl:text> |
1719 | <xsl:apply-templates select="."/> | 1740 | <xsl:apply-templates select="."/> |
1720 | </xsl:for-each> | 1741 | </xsl:for-each> |
1721 | </xsl:if> | 1742 | </xsl:if> |
1722 | </xsl:template> | 1743 | </xsl:template> |
1723 | 1744 | ||
1724 | 1745 | ||
1725 | <xsl:template match="xqx:singleType"> | 1746 | <xsl:template match="xqx:singleType"> |
1726 | <xsl:apply-templates select="xqx:atomicType"/> | 1747 | <xsl:apply-templates select="xqx:atomicType"/> |
1727 | <xsl:if test="xqx:optional"> | 1748 | <xsl:if test="xqx:optional"> |
1728 | <xsl:text>?</xsl:text> | 1749 | <xsl:text>?</xsl:text> |
1729 | </xsl:if> | 1750 | </xsl:if> |
1730 | </xsl:template> | 1751 | </xsl:template> |
1731 | 1752 | ||
1732 | 1753 | ||
1733 | <xsl:template match="xqx:typeDeclaration"> | 1754 | <xsl:template match="xqx:typeDeclaration"> |
1734 | <xsl:text> as </xsl:text> | 1755 | <xsl:text> as </xsl:text> |
1735 | <xsl:apply-templates select="*"/> | 1756 | <xsl:apply-templates select="*"/> |
1736 | </xsl:template> | 1757 | </xsl:template> |
1737 | 1758 | ||
1738 | 1759 | ||
1739 | <!-- contextItemDecl shouldn't have sequenceType, but itemType --> | 1760 | <!-- contextItemDecl shouldn't have sequenceType, but itemType --> |
1740 | <xsl:template match="xqx:contextItemType"> | 1761 | <xsl:template match="xqx:contextItemType"> |
1741 | <xsl:text> as </xsl:text> | 1762 | <xsl:text> as </xsl:text> |
1742 | <xsl:apply-templates select="*"/> | 1763 | <xsl:apply-templates select="*"/> |
1743 | </xsl:template> | 1764 | </xsl:template> |
1744 | 1765 | ||
1745 | 1766 | ||
1746 | <!-- contextItemDecl shouldn't have sequenceType, but itemType --> | 1767 | <!-- contextItemDecl shouldn't have sequenceType, but itemType --> |
1747 | <xsl:template match="xqx:contextItemDecl"> | 1768 | <xsl:template match="xqx:contextItemDecl"> |
1748 | <xsl:text>declare context item </xsl:text> | 1769 | <xsl:text>declare context item </xsl:text> |
1749 | <xsl:apply-templates select="xqx:contextItemType"/> | 1770 | <xsl:apply-templates select="xqx:contextItemType"/> |
1750 | <xsl:if test="xqx:varValue"> | 1771 | <xsl:if test="xqx:varValue"> |
1751 | <xsl:value-of select="$SPACE"/> | 1772 | <xsl:value-of select="$SPACE"/> |
1752 | <xsl:value-of select="$ASSIGN"/> | 1773 | <xsl:value-of select="$ASSIGN"/> |
1753 | <xsl:value-of select="$SPACE"/> | 1774 | <xsl:value-of select="$SPACE"/> |
1754 | <xsl:apply-templates select="xqx:varValue"/> | 1775 | <xsl:apply-templates select="xqx:varValue"/> |
1755 | </xsl:if> | 1776 | </xsl:if> |
1756 | <xsl:if test="xqx:external"> | 1777 | <xsl:if test="xqx:external"> |
1757 | <xsl:text> external </xsl:text> | 1778 | <xsl:text> external </xsl:text> |
1758 | <xsl:if test="xqx:external/xqx:varValue"> | 1779 | <xsl:if test="xqx:external/xqx:varValue"> |
1759 | <xsl:text>:= </xsl:text> | 1780 | <xsl:text>:= </xsl:text> |
1760 | <xsl:apply-templates select="xqx:external/xqx:varValue"/> | 1781 | <xsl:apply-templates select="xqx:external/xqx:varValue"/> |
1761 | </xsl:if> | 1782 | </xsl:if> |
1762 | </xsl:if> | 1783 | </xsl:if> |
1763 | </xsl:template> | 1784 | </xsl:template> |
1764 | 1785 | ||
1765 | 1786 | ||
1766 | <xsl:template match="xqx:annotation"> | 1787 | <xsl:template match="xqx:annotation"> |
1767 | <xsl:value-of select="$SPACE"/> | 1788 | <xsl:value-of select="$SPACE"/> |
1768 | <xsl:value-of select="$PERCENT"/> | 1789 | <xsl:value-of select="$PERCENT"/> |
1769 | <xsl:apply-templates select="xqx:annotationName"/> | 1790 | <xsl:apply-templates select="xqx:annotationName"/> |
1770 | <xsl:if test="xqx:arguments"> | 1791 | <xsl:if test="xqx:arguments"> |
1771 | <xsl:for-each select="xqx:arguments"> | 1792 | <xsl:for-each select="xqx:arguments"> |
1772 | <xsl:call-template name="parenthesizedList"/> | 1793 | <xsl:call-template name="parenthesizedList"/> |
1773 | </xsl:for-each> | 1794 | </xsl:for-each> |
1774 | </xsl:if> | 1795 | </xsl:if> |
1775 | </xsl:template> | 1796 | </xsl:template> |
1776 | 1797 | ||
1777 | 1798 | ||
1778 | <xsl:template match="xqx:varDecl"> | 1799 | <xsl:template match="xqx:varDecl"> |
1779 | <xsl:text>declare</xsl:text> | 1800 | <xsl:text>declare</xsl:text> |
1780 | <xsl:apply-templates select="xqx:annotation"/> | 1801 | <xsl:apply-templates select="xqx:annotation"/> |
1781 | <xsl:text> variable </xsl:text> | 1802 | <xsl:text> variable </xsl:text> |
1782 | <xsl:value-of select="$DOLLAR"/> | 1803 | <xsl:value-of select="$DOLLAR"/> |
1783 | <xsl:apply-templates select="xqx:varName"/> | 1804 | <xsl:apply-templates select="xqx:varName"/> |
1784 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 1805 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
1785 | <xsl:if test="xqx:varValue"> | 1806 | <xsl:if test="xqx:varValue"> |
1786 | <xsl:value-of select="$ASSIGN"/> | 1807 | <xsl:value-of select="$ASSIGN"/> |
1787 | <xsl:apply-templates select="xqx:varValue"/> | 1808 | <xsl:apply-templates select="xqx:varValue"/> |
1788 | </xsl:if> | 1809 | </xsl:if> |
1789 | <xsl:if test="xqx:external"> | 1810 | <xsl:if test="xqx:external"> |
1790 | <xsl:text> external </xsl:text> | 1811 | <xsl:text> external </xsl:text> |
1791 | <xsl:if test="xqx:external/xqx:varValue"> | 1812 | <xsl:if test="xqx:external/xqx:varValue"> |
1792 | <xsl:text>:= </xsl:text> | 1813 | <xsl:text>:= </xsl:text> |
1793 | <xsl:apply-templates select="xqx:external/xqx:varValue"/> | 1814 | <xsl:apply-templates select="xqx:external/xqx:varValue"/> |
1794 | </xsl:if> | 1815 | </xsl:if> |
1795 | </xsl:if> | 1816 | </xsl:if> |
1796 | </xsl:template> | 1817 | </xsl:template> |
1797 | 1818 | ||
1798 | 1819 | ||
1799 | <xsl:template match="xqx:targetLocation"> | 1820 | <xsl:template match="xqx:targetLocation"> |
1800 | <xsl:choose> | 1821 | <xsl:choose> |
1801 | <xsl:when test="position()=1"> at </xsl:when> | 1822 | <xsl:when test="position()=1"> at </xsl:when> |
1802 | <xsl:otherwise>,
 </xsl:otherwise> | 1823 | <xsl:otherwise>,
 </xsl:otherwise> |
1803 | </xsl:choose> | 1824 | </xsl:choose> |
1804 | <xsl:call-template name="quote"> | 1825 | <xsl:call-template name="quote"> |
1805 | <xsl:with-param name="item" select="."/> | 1826 | <xsl:with-param name="item" select="."/> |
1806 | </xsl:call-template> | 1827 | </xsl:call-template> |
1807 | </xsl:template> | 1828 | </xsl:template> |
1808 | 1829 | ||
1809 | 1830 | ||
1810 | <xsl:template match="xqx:schemaImport"> | 1831 | <xsl:template match="xqx:schemaImport"> |
1811 | <xsl:text> import schema </xsl:text> | 1832 | <xsl:text> import schema </xsl:text> |
1812 | <xsl:if test="xqx:defaultElementNamespace"> | 1833 | <xsl:if test="xqx:defaultElementNamespace"> |
1813 | <xsl:text> default element namespace </xsl:text> | 1834 | <xsl:text> default element namespace </xsl:text> |
1814 | </xsl:if> | 1835 | </xsl:if> |
1815 | <xsl:if test="xqx:namespacePrefix"> | 1836 | <xsl:if test="xqx:namespacePrefix"> |
1816 | <xsl:text> namespace </xsl:text> | 1837 | <xsl:text> namespace </xsl:text> |
1817 | <xsl:value-of select="xqx:namespacePrefix"/> | 1838 | <xsl:value-of select="xqx:namespacePrefix"/> |
1818 | <xsl:value-of select="$EQUAL"/> | 1839 | <xsl:value-of select="$EQUAL"/> |
1819 | </xsl:if> | 1840 | </xsl:if> |
1820 | <xsl:call-template name="quote"> | 1841 | <xsl:call-template name="quote"> |
1821 | <xsl:with-param name="item" select="xqx:targetNamespace"/> | 1842 | <xsl:with-param name="item" select="xqx:targetNamespace"/> |
1822 | </xsl:call-template> | 1843 | </xsl:call-template> |
1823 | <xsl:apply-templates select="xqx:targetLocation"/> | 1844 | <xsl:apply-templates select="xqx:targetLocation"/> |
1824 | </xsl:template> | 1845 | </xsl:template> |
1825 | 1846 | ||
1826 | 1847 | ||
1827 | <xsl:template match="xqx:moduleImport"> | 1848 | <xsl:template match="xqx:moduleImport"> |
1828 | <xsl:text> import module </xsl:text> | 1849 | <xsl:text> import module </xsl:text> |
1829 | <xsl:if test="xqx:namespacePrefix"> | 1850 | <xsl:if test="xqx:namespacePrefix"> |
1830 | <xsl:text> namespace </xsl:text> | 1851 | <xsl:text> namespace </xsl:text> |
1831 | <xsl:value-of select="xqx:namespacePrefix"/> | 1852 | <xsl:value-of select="xqx:namespacePrefix"/> |
1832 | <xsl:value-of select="$EQUAL"/> | 1853 | <xsl:value-of select="$EQUAL"/> |
1833 | </xsl:if> | 1854 | </xsl:if> |
1834 | <xsl:call-template name="quote"> | 1855 | <xsl:call-template name="quote"> |
1835 | <xsl:with-param name="item" select="xqx:targetNamespace"/> | 1856 | <xsl:with-param name="item" select="xqx:targetNamespace"/> |
1836 | </xsl:call-template> | 1857 | </xsl:call-template> |
1837 | <xsl:apply-templates select="xqx:targetLocation"/> | 1858 | <xsl:apply-templates select="xqx:targetLocation"/> |
1838 | </xsl:template> | 1859 | </xsl:template> |
1839 | 1860 | ||
1840 | 1861 | ||
1841 | <xsl:template match="xqx:param"> | 1862 | <xsl:template match="xqx:param"> |
1842 | <xsl:value-of select="$DOLLAR"/> | 1863 | <xsl:value-of select="$DOLLAR"/> |
1843 | <xsl:apply-templates select="xqx:varName"/> | 1864 | <xsl:apply-templates select="xqx:varName"/> |
1844 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 1865 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
1845 | </xsl:template> | 1866 | </xsl:template> |
1846 | 1867 | ||
1847 | 1868 | ||
1848 | <xsl:template match="xqx:paramList"> | 1869 | <xsl:template match="xqx:paramList"> |
1849 | <xsl:call-template name="parenthesizedList"/> | 1870 | <xsl:call-template name="parenthesizedList"/> |
1850 | </xsl:template> | 1871 | </xsl:template> |
1851 | 1872 | ||
1852 | 1873 | ||
1853 | <xsl:template match="xqx:functionBody"> | 1874 | <xsl:template match="xqx:functionBody"> |
1854 | <xsl:value-of select="$NEWLINE"/> | 1875 | <xsl:value-of select="$NEWLINE"/> |
1855 | <xsl:value-of select="$LBRACE"/> | 1876 | <xsl:value-of select="$LBRACE"/> |
1856 | <xsl:value-of select="$NEWLINE"/> | 1877 | <xsl:value-of select="$NEWLINE"/> |
1857 | <xsl:apply-templates/> | 1878 | <xsl:apply-templates/> |
1858 | <xsl:value-of select="$NEWLINE"/> | 1879 | <xsl:value-of select="$NEWLINE"/> |
1859 | <xsl:value-of select="$RBRACE"/> | 1880 | <xsl:value-of select="$RBRACE"/> |
1860 | </xsl:template> | 1881 | </xsl:template> |
1861 | 1882 | ||
1862 | 1883 | ||
1863 | <xsl:template match="xqx:functionDecl"> | 1884 | <xsl:template match="xqx:functionDecl"> |
1864 | <xsl:text>declare</xsl:text> | 1885 | <xsl:text>declare</xsl:text> |
1865 | <xsl:apply-templates select="xqx:annotation"/> | 1886 | <xsl:apply-templates select="xqx:annotation"/> |
1866 | <xsl:text> function </xsl:text> | 1887 | <xsl:text> function </xsl:text> |
1867 | <xsl:apply-templates select="xqx:functionName"/> | 1888 | <xsl:apply-templates select="xqx:functionName"/> |
1868 | <xsl:apply-templates select="xqx:paramList"/> | 1889 | <xsl:apply-templates select="xqx:paramList"/> |
1869 | <xsl:apply-templates select="xqx:typeDeclaration"/> | 1890 | <xsl:apply-templates select="xqx:typeDeclaration"/> |
1870 | <xsl:choose> | 1891 | <xsl:choose> |
1871 | <xsl:when test="xqx:externalDefinition"> | 1892 | <xsl:when test="xqx:externalDefinition"> |
1872 | <xsl:text> external </xsl:text> | 1893 | <xsl:text> external </xsl:text> |
1873 | </xsl:when> | 1894 | </xsl:when> |
1874 | <xsl:otherwise> | 1895 | <xsl:otherwise> |
1875 | <xsl:apply-templates select="xqx:functionBody"/> | 1896 | <xsl:apply-templates select="xqx:functionBody"/> |
1876 | </xsl:otherwise> | 1897 | </xsl:otherwise> |
1877 | </xsl:choose> | 1898 | </xsl:choose> |
1878 | </xsl:template> | 1899 | </xsl:template> |
1879 | 1900 | ||
1880 | 1901 | ||
1881 | <xsl:template match="xqx:queryBody"> | 1902 | <xsl:template match="xqx:queryBody"> |
1882 | <xsl:apply-templates select="*"/> | 1903 | <xsl:apply-templates select="*"/> |
1883 | <xsl:value-of select="$NEWLINE"/> | 1904 | <xsl:value-of select="$NEWLINE"/> |
1884 | </xsl:template> | 1905 | </xsl:template> |
1885 | 1906 | ||
1886 | <xsl:template match="xqx:moduleDecl"> | 1907 | <xsl:template match="xqx:moduleDecl"> |
1887 | <xsl:text> module namespace </xsl:text> | 1908 | <xsl:text> module namespace </xsl:text> |
1888 | <xsl:value-of select="xqx:prefix"/> | 1909 | <xsl:value-of select="xqx:prefix"/> |
1889 | <xsl:value-of select="$EQUAL"/> | 1910 | <xsl:value-of select="$EQUAL"/> |
1890 | <xsl:call-template name="quote"> | 1911 | <xsl:call-template name="quote"> |
1891 | <xsl:with-param name="item" select="xqx:uri" /> | 1912 | <xsl:with-param name="item" select="xqx:uri" /> |
1892 | </xsl:call-template> | 1913 | </xsl:call-template> |
1893 | <xsl:value-of select="$SEPARATOR"/> | 1914 | <xsl:value-of select="$SEPARATOR"/> |
1894 | <xsl:value-of select="$NEWLINE"/> | 1915 | <xsl:value-of select="$NEWLINE"/> |
1895 | </xsl:template> | 1916 | </xsl:template> |
1896 | 1917 | ||
1897 | 1918 | ||
1898 | <xsl:template match="xqx:prolog"> | 1919 | <xsl:template match="xqx:prolog"> |
1899 | <xsl:for-each select="*"> | 1920 | <xsl:for-each select="*"> |
1900 | <xsl:apply-templates select="."/> | 1921 | <xsl:apply-templates select="."/> |
1901 | <xsl:value-of select="$SEPARATOR"/> | 1922 | <xsl:value-of select="$SEPARATOR"/> |
1902 | <xsl:value-of select="$NEWLINE"/> | 1923 | <xsl:value-of select="$NEWLINE"/> |
1903 | </xsl:for-each> | 1924 | </xsl:for-each> |
1904 | </xsl:template> | 1925 | </xsl:template> |
1905 | 1926 | ||
1906 | 1927 | ||
1907 | <xsl:template match="xqx:libraryModule"> | 1928 | <xsl:template match="xqx:libraryModule"> |
1908 | <xsl:apply-templates select="xqx:moduleDecl"/> | 1929 | <xsl:apply-templates select="xqx:moduleDecl"/> |
1909 | <xsl:apply-templates select="xqx:prolog"/> | 1930 | <xsl:apply-templates select="xqx:prolog"/> |
1910 | </xsl:template> | 1931 | </xsl:template> |
1911 | 1932 | ||
1912 | 1933 | ||
1913 | <xsl:template match="xqx:mainModule"> | 1934 | <xsl:template match="xqx:mainModule"> |
1914 | <xsl:apply-templates select="xqx:prolog"/> | 1935 | <xsl:apply-templates select="xqx:prolog"/> |
1915 | <xsl:apply-templates select="xqx:queryBody"/> | 1936 | <xsl:apply-templates select="xqx:queryBody"/> |
1916 | </xsl:template> | 1937 | </xsl:template> |
1917 | 1938 | ||
1918 | 1939 | ||
1919 | <!-- Enhanced to properly support encoding parameter --> | 1940 | <!-- Enhanced to properly support encoding parameter --> |
1920 | <xsl:template match="xqx:module" priority="2"> | 1941 | <xsl:template match="xqx:module" priority="2"> |
1921 | <xsl:choose> | 1942 | <xsl:choose> |
1922 | <xsl:when test="xqx:versionDecl/xqx:encoding"> | 1943 | <xsl:when test="xqx:versionDecl/xqx:encoding"> |
1923 | <xsl:variable name="enc"> | 1944 | <xsl:variable name="enc"> |
1924 | <xsl:value-of select='xqx:versionDecl/xqx:encoding'/> | 1945 | <xsl:value-of select='xqx:versionDecl/xqx:encoding'/> |
1925 | </xsl:variable> | 1946 | </xsl:variable> |
1926 | <xsl:result-document encoding="{$enc}"> | 1947 | <xsl:result-document encoding="{$enc}"> |
1927 | <xsl:apply-templates select="*"/> | 1948 | <xsl:apply-templates select="*"/> |
1928 | <xsl:fallback> | 1949 | <xsl:fallback> |
1929 | <xsl:apply-templates select="*"/> | 1950 | <xsl:apply-templates select="*"/> |
1930 | </xsl:fallback> | 1951 | </xsl:fallback> |
1931 | </xsl:result-document> | 1952 | </xsl:result-document> |
1932 | </xsl:when> | 1953 | </xsl:when> |
1933 | <xsl:otherwise> | 1954 | <xsl:otherwise> |
1934 | <xsl:apply-templates select="*"/> | 1955 | <xsl:apply-templates select="*"/> |
1935 | </xsl:otherwise> | 1956 | </xsl:otherwise> |
1936 | </xsl:choose> | 1957 | </xsl:choose> |
1937 | </xsl:template> | 1958 | </xsl:template> |
1938 | 1959 | ||
1939 | 1960 | ||
1940 | <xsl:template match="/xqx:*"> | 1961 | <xsl:template match="/xqx:*"> |
1941 | <xsl:message terminate="yes">Incorrect XQueryX: The only top-level element permitted is xqx:module</xsl:message> | 1962 | <xsl:message terminate="yes">Incorrect XQueryX: The only top-level element permitted is xqx:module</xsl:message> |
1942 | </xsl:template> | 1963 | </xsl:template> |
1943 | 1964 | ||
1944 | 1965 | ||
1945 | </xsl:stylesheet> | 1966 | </xsl:stylesheet> |
1946 | ]]> | 1967 | ]]> |
1968 |