Changeset 4433
- Timestamp:
- 02/05/14 09:50:26 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cats/SCHEMAcat/trunk/urn.org.basex.rest/rest/query.dpml
r3874 r4433 13 13 xmlns:rest="http://basex.org/rest"> 14 14 <!-- transform the XQuery XML into a valid BaseX REST Query document --> 15 <xsl:import href="active:sloot.xquery-wrapers.escape"/> 15 16 <xsl:param name="vararg"/> 16 17 <xsl:param name="debug"/> … … 50 51 <!-- Enable BaseX 'writeback' functionality for every query --> 51 52 <xsl:text>declare option db:writeback "true";</xsl:text> 52 <xsl:apply-templates mode="copy" select="./node()"/> 53 <xsl:for-each select="./node()"> 54 <xsl:choose> 55 <xsl:when test="self::text()"> 56 <xsl:apply-templates select="."/> 57 </xsl:when> 58 <xsl:otherwise> 59 <xsl:apply-templates select="." mode="escape"/> 60 </xsl:otherwise> 61 </xsl:choose> 62 </xsl:for-each> 53 63 </rest:text> 54 64 <!-- pass on any additonal arguments as variables --> … … 67 77 </xsl:for-each> 68 78 </rest:query> 69 </xsl:template>70 <!-- turn an element node into an escaped XML string -->71 <xsl:template match="element()" mode="copy">72 <xsl:text><</xsl:text>73 <xsl:value-of select="name()"/>74 <xsl:apply-templates select="@*" mode="#current"/>75 <xsl:text>></xsl:text>76 <xsl:apply-templates mode="#current"/>77 <xsl:text></</xsl:text>78 <xsl:value-of select="name()"/>79 <xsl:text>></xsl:text>80 </xsl:template>81 <!-- turn an attribute node into an escaped XML string -->82 <xsl:template match="@*" mode="copy">83 <xsl:text> </xsl:text>84 <xsl:value-of select="name()"/>85 <xsl:text>="</xsl:text>86 <xsl:value-of87 select="replace(replace(replace(replace(replace(.,'&','&amp;'),'''','&apos;'),'<','&lt;'),'>','&gt;'),'"','&quot;')"/>88 <xsl:text>"</xsl:text>89 </xsl:template>90 <!-- turn a text node into an escaped XML string -->91 <xsl:template match="text()" mode="copy">92 <xsl:value-of select="normalize-space(.)"/>93 79 </xsl:template> 94 80 </xsl:stylesheet> … … 129 115 <argument name="operator"> 130 116 <literal type="xml"> 131 <hds> 132 <Authorization>Basic {string($base64-db-auth-token)}</Authorization> 133 </hds> 117 <query> 118 <hds> 119 <Authorization>Basic {string($base64-db-auth-token)}</Authorization> 120 </hds> 121 </query> 134 122 </literal> 135 123 </argument>
Note: See TracChangeset
for help on using the changeset viewer.