ChangeVariableCtrl

1.0 http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/02/22-rdf-syntax-ns# http://www.askemos.org/2000/CoreAPI http://www.askemos.org/2000/NameSpaceDSSSL

Sorry, forget it, but I'm not gonna show you that.


Source code:

<!--

This control is somewhat semi-optimal.  See GCAICtrl for the DSSSL way
of doing the same thing shorter way.  That style sheet also uses
normal xml element to store state, while this here uses xsl variables,
which are evaluated.

This control rebuilds the currently executed style sheet

-->
<dsssl:when xmlns:dsssl="http://www.askemos.org/2000/NameSpaceDSSSL" xmlns:mind="http://www.askemos.org/2000/CoreAPI" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" test="
 (and (eq? (me &apos;get &apos;id) (msg &apos;dc-creator))
      (equal? (data (form-field &quot;action&quot; (current-node)))
              &quot;change-variable&quot;))" version="1.0" xml:space="default">
 <mind:reply>
  <xsl:variable name="cn">
   <dsssl:copy-of select="(current-node)"></dsssl:copy-of>
  </xsl:variable>
  <xsl:variable name="new-variable">
   <dsssl:for-each select="
         (xsl-variable (data (form-field &quot;varnam&quot; (current-node))))">
    <dsssl:copy-of select="
         (make element gi:(gi (current-node))
           attributes:
            (let loop ((atts (named-node-list-names
                             (attributes (current-node)))))
             (if (null? atts)
              &apos;()
              (let* ((name (car atts))
                     (nspace (attribute-ns  name (current-node)))
                     (value  (attribute-string name (current-node))))
               (cons (list nspace name value)
                     (loop (cdr atts))))))
          (literal (data (form-field (symbol-&gt;string (gi
(current-node)))
                                     (xsl-variable &quot;cn&quot;)))))"></dsssl:copy-of>
   </dsssl:for-each>
  </xsl:variable>
  <xsl:element xmlns:nu="nu" name="stylesheet" namespace="http://www.w3.org/1999/XSL/Transform">
   <xsl:attribute name="version">1.0</xsl:attribute>
   <xsl:attribute name="xsl" namespace="xmlns">
    <nu:q>http://www.w3.org/1999/XSL/Transform</nu:q>
   </xsl:attribute>
   <xsl:attribute name="rdf" namespace="xmlns">
    <nu:q>http://www.w3.org/1999/02/22-rdf-syntax-ns#</nu:q>
   </xsl:attribute>
   <xsl:attribute name="mind" namespace="xmlns">
    <nu:q>http://www.askemos.org/2000/CoreAPI</nu:q>
   </xsl:attribute>
   <xsl:attribute name="dsssl" namespace="xmlns">
    <nu:q>http://www.askemos.org/2000/NameSpaceDSSSL</nu:q>
   </xsl:attribute>
   <dsssl:for-each select="
         (children (document-element (grove-root (current-node))))">
    <xsl:choose>
     <dsssl:when test="(and
           (eq?    (gi (current-node)) (string-&gt;symbol &quot;variable&quot;))
           (equal? (attribute-string &quot;name&quot;   (current-node))
                   (data (form-field &quot;varnam&quot; (xsl-variable &quot;cn&quot;)))))">
      <xsl:element name="variable" namespace="http://www.w3.org/1999/XSL/Transform">
       <xsl:attribute name="name">
        <dsssl:copy-of select="
              (data (form-field &quot;varnam&quot; (xsl-variable &quot;cn&quot;)))"></dsssl:copy-of>
       </xsl:attribute>
       <dsssl:copy-of select="(xsl-variable &quot;new-variable&quot;)"></dsssl:copy-of>
      </xsl:element>
     </dsssl:when>
     <xsl:otherwise>
      <dsssl:copy-of select="(current-node)"></dsssl:copy-of>
     </xsl:otherwise>
    </xsl:choose>
   </dsssl:for-each>
  </xsl:element>
  <mind:output>
   <body>
    <p>Sorry, forget it, but I'm not gonna show you that.</p>
   </body>
  </mind:output>
 </mind:reply>
</dsssl:when>

Diese Seite findet man von: overview, .




Letzte Modifikation: Thu, 06 Feb 2003 14:42:20 +0100

Autor(en):

Dokument Nummer A67bb0753e1676f81983e0ecf3a15b391 geliefert an public um Thu, 20 Nov 2008 16:21:20 +0100