XSQLConnectionLessTest

xsql test interface

Update

Query



Result

(root (let ((this-root (document-element (grove-root (current-node))))) (make element gi: (gi this-root) ns: (ns this-root) attributes: (copy-attributes this-root) (node-list-map (lambda (node) (cond ((match-element? 'state node) (make element gi: (gi node) ns: (ns node) (let ((query (form-field 'query (current-node)))) (if (equal? (data query) "") ((sxpath '(query)) node) query)) (let ((update (form-field 'update (current-node)))) (if (equal? (data update) "") ((sxpath '(update)) node) update)))) (else node))) ;; The children of the root of the style sheet. (children this-root)))))

Source code:

<xsl:stylesheet xmlns:core="http://www.askemos.org/2000/CoreAPI" xmlns:d="http://www.askemos.org/2000/NameSpaceDSSSL" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsql="http://www.askemos.org/2006/XSQL/" version="1.0">
 <state>
  <query></query>
  <update></update>
 </state>
 <xsl:variable name="query">
  <d:copy-of select="
        (literal (data (form-field &apos;query (current-node))))"></d:copy-of>
 </xsl:variable>
 <xsl:variable name="update">
  <d:copy-of select="
        (literal (data (form-field &apos;update (current-node))))"></d:copy-of>
 </xsl:variable>
 <xsl:variable name="state">
  <d:copy-of select="
  (children
   (select-elements (children (grove-root (current-node))) &apos;state)) "></d:copy-of>
 </xsl:variable>
 <xsl:template match="*[@type=&quot;read&quot;]">
  <html>
   <body bgcolor="white">
    <h2>xsql test interface</h2>
    <h3>Update</h3>
    <d:form action="&apos;()" method="POST">
     <textarea cols="60" name="update" rows="10">
      <d:copy-of select="(children (select-elements (xsl-variable &quot;state&quot;) &apos;update))"></d:copy-of>
     </textarea>
     <h3>Query</h3>
     <input type="submit"></input>
    </d:form>
    <d:form action="&apos;()" method="POST">
     <textarea cols="60" name="query" rows="10">
      <d:copy-of select="(children (select-elements (xsl-variable &quot;state&quot;) &apos;query))"></d:copy-of>
     </textarea>
     <br></br>
     <input type="submit"></input>
    </d:form>
    <h3>Result</h3>
    <xsl:variable name="result">
     <xsql:query row-element="tr" rowset-element="table">
      <d:copy-of select="(children (select-elements (xsl-variable &quot;state&quot;) &apos;query))"></d:copy-of>
     </xsql:query>
    </xsl:variable>
    <d:copy-of select="(guard (ex (else (literal ex))) (xsl-variable &quot;result&quot;))"></d:copy-of>
   </body>
  </html>
 </xsl:template>
 <xsl:template match="*[@type=&quot;write&quot;]">
  <d:if test="(service-level)">
   <core:reply>
    <d:if test="(not (equal? (data (form-field &apos;update (current-node))) &quot;&quot;))">
     <core:update row-element="tr" rowset-element="table">
      <d:copy-of select="(form-field &apos;update (current-node))"></d:copy-of>
     </core:update>
    </d:if>
    <core:continue>
     <d:copy-of select="#CONTENT">

(root
  (let ((this-root (document-element (grove-root (current-node)))))
    (make element
      gi: (gi this-root) ns: (ns this-root)
      attributes: (copy-attributes this-root)
      (node-list-map
       (lambda (node)
         (cond
          ((match-element? 'state node)
           (make element
               gi: (gi node) ns: (ns node)
               (let ((query (form-field 'query (current-node))))
                 (if (equal? (data query) "")
                     ((sxpath '(query)) node)
                     query))
               (let ((update (form-field 'update (current-node))))
                 (if (equal? (data update) "")
                     ((sxpath '(update)) node)
                     update))))
          (else node)))
       ;; The children of the root of the style sheet.
       (children this-root)))))

 </d:copy-of>
    </core:continue>
   </core:reply>
  </d:if>
 </xsl:template>
</xsl:stylesheet>

Diese Seite findet man von: overview, .




Letzte Modifikation: Mon, 12 Dec 2005 14:46:29 +0100

Autor(en): jfw,

Dokument Nummer A67bb0753e1676f81983e0ecf3a15b391 geliefert an public um Sun, 07 Sep 2008 19:29:40 +0200