Changeset 3165
- Timestamp:
- 07/18/13 16:19:57 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cats/SCHEMAcat/trunk/urn.org.basex.rest/rest/query.dpml
r3117 r3165 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 <sequence debug=" false" profile="false">2 <sequence debug="true" profile="false"> 3 3 <!-- load BaseX DB configuration parameters --> 4 4 <request assignment="config"> … … 15 15 <xsl:param name="vararg"/> 16 16 <xsl:param name="debug"/> 17 <xsl:variable name="NL" select="system-property('line.separator')"/> 18 <xsl:template match="*[empty(parent::*)]"> 19 <xsl:variable name="root" select="current()"/> 17 <xsl:template match="query"> 20 18 <rest:query> 21 19 <rest:text> 22 <!-- turn the namespaces in scope of the root element into 'declare namespace' statements --> 23 <xsl:for-each 24 select="in-scope-prefixes($root)[not(.=('xml','xs','xsi','fn','local'))]"> 25 <xsl:variable name="prefix" select="current()"/> 26 <xsl:choose> 27 <xsl:when test="$prefix=''"> 28 <xsl:text>declare default namespace "</xsl:text> 29 <xsl:value-of 30 select="namespace-uri-for-prefix($prefix,$root)"/> 31 <xsl:text>";</xsl:text> 32 <xsl:value-of select="$NL"/> 33 </xsl:when> 34 <xsl:otherwise> 35 <xsl:text>declare namespace </xsl:text> 36 <xsl:value-of select="$prefix"/> 37 <xsl:text> = "</xsl:text> 38 <xsl:value-of 39 select="namespace-uri-for-prefix($prefix,$root)"/> 40 <xsl:text>";</xsl:text> 41 <xsl:value-of select="$NL"/> 42 </xsl:otherwise> 43 </xsl:choose> 44 </xsl:for-each> 20 <xsl:variable name="current-node" select="."/> 21 <!-- turn the namespaces in scope of the root element into 'declare namespace' statements --> 22 <xsl:for-each 23 select="in-scope-prefixes($current-node)[not(.=('xml','xs','xsi','fn','local'))]"> 24 <xsl:variable name="prefix" select="current()"/> 25 <xsl:choose> 26 <xsl:when test="$prefix=''"> 27 <xsl:text>declare default element namespace "</xsl:text> 28 <xsl:value-of 29 select="namespace-uri-for-prefix($prefix,$current-node)"/> 30 <xsl:text>";</xsl:text> 31 </xsl:when> 32 <xsl:otherwise> 33 <xsl:text>declare namespace </xsl:text> 34 <xsl:value-of select="$prefix"/> 35 <xsl:text> = "</xsl:text> 36 <xsl:value-of 37 select="namespace-uri-for-prefix($prefix,$current-node)"/> 38 <xsl:text>";</xsl:text> 39 </xsl:otherwise> 40 </xsl:choose> 41 </xsl:for-each> 45 42 <!-- turn any additional arguments into variables --> 46 43 <xsl:for-each 47 select="$vararg/arguments/*[not(name()=('operator','query' ))]">44 select="$vararg/arguments/*[not(name()=('operator','query','sloot-operator'))]"> 48 45 <xsl:variable name="var" select="name()"/> 49 46 <xsl:text>declare variable $</xsl:text> 50 47 <xsl:value-of select="$var"/> 51 48 <xsl:text> external;</xsl:text> 52 <xsl:value-of select="$NL"/>53 49 </xsl:for-each> 54 <xsl:apply-templates mode="copy" select=". "/>50 <xsl:apply-templates mode="copy" select="./node()"/> 55 51 </rest:text> 56 52 <!-- pass on any additonal arguments as variables --> 57 53 <xsl:for-each 58 select="$vararg/arguments/*[not(name()=('operator','query' ))]">54 select="$vararg/arguments/*[not(name()=('operator','query','sloot-operator'))]"> 59 55 <xsl:if test="$debug"> 60 56 <xsl:message>DBG: variable name[<xsl:value-of select="name()" … … 88 84 <!-- turn a text node into an escaped XML string --> 89 85 <xsl:template match="text()" mode="copy"> 90 <xsl:value-of select=" ."/>86 <xsl:value-of select="normalize-space(.)"/> 91 87 </xsl:template> 92 88 </xsl:stylesheet> … … 122 118 <argument name="operand">this:config</argument> 123 119 <argument name="operator"> 124 <literal type="string" 125 >/nvp/concat(basex-db-username,':',basex-db-password)</literal> 120 <literal type="string">/nvp/concat(basex-db-username,':',basex-db-password)</literal> 126 121 </argument> 127 122 </request> … … 130 125 </argument> 131 126 </request> 132 <sloot-debug>133 <request>134 <verb>SINK</verb>135 <identifier>res:/debug-basex/org.basex.auth.xml</identifier>136 <argument name="primary">this:AuthHeader</argument>137 </request>138 </sloot-debug>139 127 <!-- Compute BaseX endpoint --> 140 128 <request assignment="db-endpoint"> … … 142 130 <argument name="operand">this:config</argument> 143 131 <argument name="operator"> 144 <literal type="string" 145 >/nvp/concat('http://',basex-rest-host,':',basex-rest-port,'/',basex-rest-path,'/',basex-db-name)</literal> 132 <literal type="string">/nvp/concat('http://',basex-rest-host,':',basex-rest-port,'/',basex-rest-path,'/',basex-db-name)</literal> 146 133 </argument> 147 134 </request>
Note: See TracChangeset
for help on using the changeset viewer.