cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r190730 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/forms/samples/ src/blocks/forms/samples/sqldatabase/
Date Wed, 15 Jun 2005 11:04:39 GMT
Author: bdelacretaz
Date: Wed Jun 15 04:04:37 2005
New Revision: 190730

URL: http://svn.apache.org/viewcvs?rev=190730&view=rev
Log:
Patch 35364 applied, example of 'zero java code' editing of SQL data using the SQLTransformer.
Thanks to Askild Aaberg Olsen

Added:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/dbdemo.js
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/document.jx
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employee-sql.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employees-sql.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2html.xslt
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2sql.xslt
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-binding.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-definition.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-template.xml
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sitemap.xmap
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sqlxml2employeexml.xslt
Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml
    cocoon/branches/BRANCH_2_1_X/status.xml

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/dbdemo.js
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/dbdemo.js?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/dbdemo.js (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/dbdemo.js Wed Jun 15
04:04:37 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+
+function employee_edit() {
+
+	var employeeId = cocoon.parameters["employeeId"];
+	var nextPage = cocoon.parameters["nextPage"];
+
+    var pu = null;
+
+	try {
+        pu = cocoon.createObject(Packages.org.apache.cocoon.components.flow.util.PipelineUtil);
+
+        // load document for form data, via a pipeline to use the SQLTransformer
+        var document = pu.processToDOM("employees/" + employeeId + ".xml", null);
+
+        // create form, bind to document and load document into it
+        var form = new Form("form-definition.xml");
+        form.createBinding("form-binding.xml");
+        form.load(document);
+
+        // display and edit form
+        form.showForm("edit-employee-form");
+
+        // save modified data to document object
+        // TODO if would be good to do this only if the data has changed
+        form.save(document);
+
+        // run pipeline to let SQLTransformer update data based on document object
+        var unusedOutput = new Packages.java.io.ByteArrayOutputStream();
+        cocoon.processPipelineTo("save-employee",{"document": document},unusedOutput);
+
+    } finally {
+        if(pu!=null) cocoon.disposeObject(pu);
+    }
+
+	cocoon.redirectTo(nextPage,true);
+}

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/document.jx
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/document.jx?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/document.jx (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/document.jx Wed Jun
15 04:04:37 2005
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">#{document/*}</jx:template>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employee-sql.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employee-sql.xml?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employee-sql.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employee-sql.xml Wed
Jun 15 04:04:37 2005
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+	<sql:query name="employee">SELECT id, name FROM employee WHERE id = <sql:substitute-value
sql:name="id"/></sql:query>
+</sql:execute-query>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employees-sql.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employees-sql.xml?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employees-sql.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employees-sql.xml Wed
Jun 15 04:04:37 2005
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+	<sql:query name="employees">SELECT id, name FROM employee ORDER BY name</sql:query>
+</sql:execute-query>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2html.xslt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2html.xslt?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2html.xslt
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2html.xslt
Wed Jun 15 04:04:37 2005
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title>CForms / SQLTransformer sample</title>
+        <link rel="stylesheet" type="text/css" href="/styles/main.css"/>
+      </head>
+
+      <body>
+        <h1>CForms / SQLTransformer sample</h1>
+        <p>
+          This sample demonstrates a way of editing SQL data via CForms without having to
write Java code.
+        </p>
+        <p>
+          The database used is the "personnel" demo database, running on the embedded
+          HSQL database provided by the "databases" block.
+        </p>
+        <p>
+          Study the sitemap (in the sqldatabase subdirectory of the CForms samples) to see
how the SQLTransformer is
+          used to load data for the CForms binding, and to update data based on the document
updated by CForms.
+        </p>
+        <p>
+          Only editing of existing data is implemented for now, complete CRUD functionality
can
+          be implemented in the same way.
+        </p>
+        <p>
+          If you look at the form definitions and SQLTransformer parameters , you'll see
that most
+          or all of it could be generated from a data dictionary or a database schema. This
would
+          of course be a welcome enhancement...
+        </p>
+
+        <h1>List of employees in database</h1>
+        <p>
+          Click one to edit, or use the XML links to view raw data:
+        </p>
+        <xsl:apply-templates/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="employee">
+    <a href="{@id}.xml">XML</a>
+    &#160;
+    <a href="{@id}/edit">
+      <xsl:value-of select="name"/>
+    </a>
+    <br/>
+  </xsl:template>
+
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2sql.xslt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2sql.xslt?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2sql.xslt
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/employeexml2sql.xslt
Wed Jun 15 04:04:37 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+
+	<xsl:template match="employee">
+		<sql:execute-query>
+			<sql:query>
+				<xsl:text>UPDATE employee SET name='</xsl:text>
+				<xsl:value-of select="name"/>
+				<xsl:text>' WHERE id =</xsl:text>
+				<xsl:value-of select="@id"/>
+			</sql:query>
+		</sql:execute-query>
+	</xsl:template>
+
+</xsl:stylesheet>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-binding.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-binding.xml?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-binding.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-binding.xml Wed
Jun 15 04:04:37 2005
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding" path="/employee" >
+    <fb:value id="id" path="@id"/>
+    <fb:value id="name" path="name"/>
+</fb:context>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-definition.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-definition.xml?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-definition.xml
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-definition.xml
Wed Jun 15 04:04:37 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
+	<fd:widgets>
+
+		<fd:output id="id">
+			<fd:label>ID:</fd:label>
+			<fd:datatype base="string"/>
+		</fd:output>
+
+		<fd:field id="name" required="true">
+			<fd:label>Name:</fd:label>
+			<fd:datatype base="string"/>
+			<fd:validation>
+				<fd:length min="2"/>
+			</fd:validation>
+		</fd:field>
+
+	</fd:widgets>
+</fd:form>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-template.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-template.xml?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-template.xml (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/form-template.xml Wed
Jun 15 04:04:37 2005
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html xmlns:ft="http://apache.org/cocoon/forms/1.0#template" xmlns:fi="http://apache.org/cocoon/forms/1.0#instance">
+	<head>
+		<title>CForms / SQLTransformer sample</title>
+    <link rel="stylesheet" type="text/css" href="/styles/main.css"/>
+	</head>
+	<body>
+		<h1>Edit employee info</h1>
+		<ft:form-template action="#{$continuation/id}.continue" method="POST">
+			<ft:widget-label id="id"/>
+			<ft:widget id="id"/>
+			<br/>
+			<ft:widget-label id="name"/>
+			<ft:widget id="name"/>
+			<br/>
+			<input type="submit"/>
+		</ft:form-template>
+    <p>(Yes, there's not much to edit- what do you expect from a sample?)</p>
+	</body>
+</html>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sitemap.xmap?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sitemap.xmap (added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sitemap.xmap Wed Jun
15 04:04:37 2005
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!--
+  CForms sqldatabase sample: edit a database via CForms
+  using the SQLTransformer to load and save data
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  <map:flow language="javascript">
+    <map:script src="dbdemo.js"/>
+  </map:flow>
+
+  <map:pipelines>
+    <map:pipeline>
+
+      <!-- Start the demo -->
+      <map:match pattern="">
+        <map:redirect-to uri="employees/"/>
+      </map:match>
+
+      <!-- Edit employee -->
+      <map:match pattern="employees/*/edit">
+        <map:call function="employee_edit">
+          <map:parameter name="employeeId" value="{1}"/>
+          <map:parameter name="nextPage" value="../../"/>
+        </map:call>
+      </map:match>
+
+      <!-- Handle continuations -->
+      <map:match pattern="**/*.continue">
+        <map:call continuation="{2}"/>
+      </map:match>
+
+      <!-- List employees, SQLTransformer runs the query -->
+      <map:match pattern="employees/">
+        <map:generate src="employees-sql.xml"/>
+        <map:transform type="sql">
+          <map:parameter name="use-connection" value="personnel"/>
+        </map:transform>
+        <!-- Transform from sqltransformer-xml to employee-xml -->
+        <map:transform type="xslt" src="sqlxml2employeexml.xslt"/>
+        <!-- Transform to web-page -->
+        <map:transform type="xslt" src="employeexml2html.xslt"/>
+        <map:serialize type="html"/>
+      </map:match>
+
+      <!-- Load one employee by id, SQLTransformer runs the query -->
+      <map:match pattern="employees/*.xml">
+        <map:generate src="employee-sql.xml"/>
+        <map:transform type="sql">
+          <map:parameter name="use-connection" value="personnel"/>
+          <map:parameter name="id" value="{1}"/>
+        </map:transform>
+        <!-- Transform from sqltransformer-xml to employee-xml -->
+        <map:transform type="xslt" src="sqlxml2employeexml.xslt"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- Save one employee, , SQLTransformer does the update -->
+      <map:match pattern="save-employee">
+        <!-- Get bound document from flow by JX -->
+        <map:generate type="jx" src="document.jx"/>
+        <!-- Brute-force update db by generating sql update-statement -->
+        <map:transform type="xslt" src="employeexml2sql.xslt"/>
+        <map:transform type="sql">
+          <map:parameter name="use-connection" value="personnel"/>
+        </map:transform>
+        <map:serialize type="xml"/>
+      </map:match>
+
+      <!-- Display the "edit employee" form -->
+      <map:match pattern="edit-employee-form">
+        <map:generate src="form-template.xml"/>
+        <map:transform type="forms"/>
+        <map:transform src="../resources/forms-samples-styling.xsl"/>
+        <map:serialize type="html"/>
+      </map:match>
+
+      <!-- Serve resources -->
+      <map:match pattern="resources/**">
+        <map:read src="resource://org/apache/cocoon/forms/resources/{1}"/>
+      </map:match>
+
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Added: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sqlxml2employeexml.xslt
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sqlxml2employeexml.xslt?rev=190730&view=auto
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sqlxml2employeexml.xslt
(added)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/sqldatabase/sqlxml2employeexml.xslt
Wed Jun 15 04:04:37 2005
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sql="http://apache.org/cocoon/SQL/2.0">
+	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
+	<xsl:template match="sql:rowset[@sql:name='employees']">
+		<employees>
+			<xsl:apply-templates/>
+		</employees>
+	</xsl:template>
+	<xsl:template match="sql:row">
+		<employee id="{sql:id}">
+			<name>
+				<xsl:value-of select="sql:name"/>
+			</name>
+		</employee>
+	</xsl:template>
+</xsl:stylesheet>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml?rev=190730&r1=190729&r2=190730&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/welcome.xml Wed Jun 15 04:04:37
2005
@@ -73,6 +73,13 @@
   -->
  </group>
 
+ <group name="Database access">
+   <sample name="Zero-code SQL database access" href="sqldatabase/">
+     SQL database editing without any custom Java code, using the SQLTransformer to load
+     and update data.
+   </sample>
+ </group>
+
  <group name="Locales">
   <note>
     The samples below are the same as the basic flowscript sample but now use different locales.

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=190730&r1=190729&r2=190730&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Jun 15 04:04:37 2005
@@ -196,7 +196,11 @@
 
   <changes>
   <release version="@version@" date="@date@">
-    <action dev="SW" type="fix" fixes-bug="35311" due-to="Jeffrey Kirby" due-to-email="jeff.kirby@wicourts.gov">
+    <action dev="BD" type="add" fixes-bug="35364" due-to="Askild Aaberg Olsen" due-to-email="askild@xangeli.com">
+       Forms block: sqldatabase sample added, demonstrates "zero java code" editing of SQL
data
+       using the SQLTransformer.
+     </action>
+     <action dev="SW" type="fix" fixes-bug="35311" due-to="Jeffrey Kirby" due-to-email="jeff.kirby@wicourts.gov">
       CForms block: Ensure FormHandler is always called when a field's value change.
     </action>
     <action dev="RP" type="update">



Mime
View raw message