Christian,
Can you please add this to C2.1? (as a sample that is accessible from the main page)
Thanks,
dims
--- Torsten Curdt <[EMAIL PROTECTED]> wrote:
> What I have here is:
> - the skeleton for the xform logicsheet
> - the selector logicsheet
> - the DOMObject skeleton
> - and a test XML
>
> I think we need to discuss the complexity
> of the DOMObject and then we could go for
> the Action.
>
> regards
> --
> Torsten
> ATTACHMENT part 2 application/octet-stream name=DOMObject.java
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xsp:page
> language="java"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:xform="http://www.w3.org/2001/06/xforms"
> xmlns:sel="http://apache.org/xsp/sel/1.0"
> >
>
> <root>
> <xform:xform id="orderForm">
> <xform:instance>
> <order>
> <firstname/>
> <lastname/>
> <email>[EMAIL PROTECTED]</email>
> <city/>
> <country/>
> <newsletter/>
> </order>
> </xform:instance>
> </xform:xform>
>
> <sel:selector type="sitemap" parameter="page">
> <sel:case name="fillin1">
> <p>Please enter your name and email address</p>
>
> <xform:textbox ref="order/firstname">
> <caption>Firstname</caption>
> </xform:textbox>
>
> <xform:textbox ref="order/lastname">
> <caption>Lastname</caption>
> </xform:textbox>
>
> <xform:textbox ref="order/email">
> <caption>Email</caption>
> </xform:textbox>
> </sel:case>
>
> <sel:case name="fillin2">
> <p>Please enter where you are located</p>
>
> <xform:textbox ref="order/city" xform="orderForm">
> <caption>City</caption>
> </xform:textbox>
>
> <xform:selectOne ref="order/country" xform="orderForm">
> <caption>Country</caption>
> <hint>Please select the country you are from</hint>
> <choices>
> <item value="none">Please select</item>
> <item value="DE">Germany</item>
> <item value="US">USA</item>
> <item value="UK">United Kingdom</item>
> </choices>
> </xform:selectOne>
>
> <xform:selectBoolean ref="order/newsletter" xform="orderForm">
> <caption>Newsletter</caption>
> <choices>
> <item value="true">Yes</item>
> <item value="false">No</item>
> </choices>
> </xform:selectBoolean>
> </sel:case>
>
> <sel:case name="overview">
> <xform:xform id="orderForm">
> <p>Is everything correct?</p>
>
> <xform:output ref="order/firstname"/>
> <xform:output ref="order/lastname"/>
> <xform:output ref="order/email"/>
> <xform:output ref="order/city"/>
> <xform:output ref="order/country"/>
> <xform:output ref="order/newsletter"/>
> </xform:xform>
>
> <xform:submitInfo target="" method="POST"/>
> </sel:case>
>
> <sel:case name="thanks">
> <p>Thank you!</p>
> </sel:case>
>
> <sel:otherwise>
> <p>Hm.. how did you get here?</p>
> </sel:otherwise>
> </sel:selector>
>
> </root>
>
> </xsp:page>> <?xml version="1.0"?>
> <!-- $Id: esql.xsl,v 1.1.2.57 2001/04/20 20:49:56 bloritsch Exp $-->
> <!--
>
> ============================================================================
> The Apache Software License, Version 1.2
> ============================================================================
>
> Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modifica-
> tion, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright notice,
> this list of conditions and the following disclaimer in the documentation
> and/or other materials provided with the distribution.
>
> 3. The end-user documentation included with the redistribution, if any, must
> include the following acknowledgment: "This product includes software
> developed by the Apache Software Foundation (http://www.apache.org/)."
> Alternately, this acknowledgment may appear in the software itself, if
> and wherever such third-party acknowledgments normally appear.
>
> 4. The names "Cocoon" and "Apache Software Foundation" must not be used to
> endorse or promote products derived from this software without prior
> written permission. For written permission, please contact
> [EMAIL PROTECTED]
>
> 5. Products derived from this software may not be called "Apache", nor may
> "Apache" appear in their name, without prior written permission of the
> Apache Software Foundation.
>
> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
> DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
> OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> This software consists of voluntary contributions made by many individuals
> on behalf of the Apache Software Foundation and was originally created by
> Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
> Software Foundation, please see <http://www.apache.org/>.
>
> -->
>
> <!--
> * @author <a href="mailto:[EMAIL PROTECTED]">Torsten Curdt</a>
> -->
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:sel="http://apache.org/xsp/sel/1.0"
> >
>
> <xsl:template match="xsp:page">
> <xsp:page>
> <xsl:copy-of select="@*"/>
>
> <xsl:for-each select=".//sel:case|.//sel:otherwise">
> <xsp:logic>
> private void _<xsl:value-of
>select="parent::sel:selector/@parameter"/>_<xsl:value-of
> select="@name"/>_case() throws SAXException {
> AttributesImpl xspAttr = new AttributesImpl();
> <xsl:apply-templates/>
> }
> </xsp:logic>
> </xsl:for-each>
>
> <xsl:apply-templates select="*[not(name()='sel:case' or
>name()='sel:otherwise')]"/>
>
> </xsp:page>
> </xsl:template>
>
> <xsl:template match="sel:selector">
> <xsp:logic>
> String selection = parameters.getParameter("<xsl:value-of
>select="@parameter"/>", null);
> </xsp:logic>
>
> <xsl:for-each select="sel:case">
> <xsp:logic>
> <xsl:if test="position() != 1"> else </xsl:if>
> if ("<xsl:value-of select="@name"/>".equals(selection)){
> _<xsl:value-of select="parent::sel:selector/@parameter"/>_<xsl:value-of
> select="@name"/>_case();
> }
> </xsp:logic>
> </xsl:for-each>
>
> <xsl:for-each select="sel:otherwise">
> <xsp:logic>
> else {
> _<xsl:value-of select="parent::sel:selector/@parameter"/>_<xsl:value-of
> select="@name"/>_case();
> }
> </xsp:logic>
> </xsl:for-each>
>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template match="@*|node()" priority="-2"><xsl:copy><xsl:apply-templates
> select="@*|node()"/></xsl:copy></xsl:template>
> <xsl:template match="text()" priority="-1"><xsl:value-of select="."/></xsl:template>
>
> </xsl:stylesheet>
> > <?xml version="1.0"?>
> <!-- $Id: esql.xsl,v 1.1.2.57 2001/04/20 20:49:56 bloritsch Exp $-->
> <!--
>
> ============================================================================
> The Apache Software License, Version 1.2
> ============================================================================
>
> Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
>
> Redistribution and use in source and binary forms, with or without modifica-
> tion, are permitted provided that the following conditions are met:
>
> 1. Redistributions of source code must retain the above copyright notice,
> this list of conditions and the following disclaimer.
>
> 2. Redistributions in binary form must reproduce the above copyright notice,
> this list of conditions and the following disclaimer in the documentation
> and/or other materials provided with the distribution.
>
> 3. The end-user documentation included with the redistribution, if any, must
> include the following acknowledgment: "This product includes software
> developed by the Apache Software Foundation (http://www.apache.org/)."
> Alternately, this acknowledgment may appear in the software itself, if
> and wherever such third-party acknowledgments normally appear.
>
> 4. The names "Cocoon" and "Apache Software Foundation" must not be used to
> endorse or promote products derived from this software without prior
> written permission. For written permission, please contact
> [EMAIL PROTECTED]
>
> 5. Products derived from this software may not be called "Apache", nor may
> "Apache" appear in their name, without prior written permission of the
> Apache Software Foundation.
>
> THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
> INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
> FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
> DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
> OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
>
> This software consists of voluntary contributions made by many individuals
> on behalf of the Apache Software Foundation and was originally created by
> Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
> Software Foundation, please see <http://www.apache.org/>.
>
> -->
>
> <!--
> * @author <a href="mailto:[EMAIL PROTECTED]">Torsten Curdt</a>
> -->
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://apache.org/xsp"
> xmlns:xform="http://www.w3.org/2001/06/xforms"
> >
>
> <xsl:template match="xsp:page">
> <xsp:page>
> <xsl:copy-of select="@*"/>
> <xsp:structure>
> <xsp:include>org.apache.cocoon.environment.Request</xsp:include>
> <xsp:include>org.apache.cocoon.environment.Session</xsp:include>
> <xsp:include>org.apache.cocoon.xml.DOMObject</xsp:include>
> <xsl:for-each select=".//*[@class]">
> <xsp:include><xsl:value-of select="@class"/></xsp:include>
> </xsl:for-each>
> </xsp:structure>
>
> <xsl:call-template name="defineForms"/>
>
> <xsp:logic>
> public boolean hasContentChanged( org.apache.cocoon.environment.Request request
>){
> return(true);
> }
> </xsp:logic>
>
> <xsl:apply-templates/>
>
> </xsp:page>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template match="xsp:page/*[not(self::xsp:*)]">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsp:logic>
> /* START <xsl:value-of select="name()"/> */
> </xsp:logic>
>
> <xsp:logic>
> Session _xform_session = request.getSession(true);
> </xsp:logic>
>
> <xsl:call-template name="getForms"/>
>
> <xsl:apply-templates/>
>
> <xsl:call-template name="setForms"/>
>
> <xsp:logic>
> /* STOP <xsl:value-of select="name()"/> */
> </xsp:logic>
> </xsl:copy>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template match="xform:instance">
> <xsl:variable name="formname" select="parent::xform:xform/@id"/>
>
> <xsp:logic>
> /* START <xsl:value-of select="name()"/> */
> </xsp:logic>
>
> <xsp:logic>
> /* pass the XML into the DOMObject */
>
> /* insert the DOMObject XML representation / current instance data */
> <!--
> <xsp:expr>_xform_<xsl:value-of select="$formname"/></xsp:expr>
> _xform_<xsl:value-of select="$formname"/>.toSAX(handler);
> -->
> </xsp:logic>
>
> <xsp:logic>
> /* STOP <xsl:value-of select="name()"/> */
> </xsp:logic>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template name="defineForm">
> <xsl:variable name="formname" select="."/>
> <xsp:logic>
> /* XForm <xsl:value-of select="$formname"/> */
> </xsp:logic>
>
> <xsl:variable name="class">
> <xsl:choose>
> <xsl:when test="../@class"><xsl:value-of select="../@class"/></xsl:when>
> <xsl:otherwise>DOMObject</xsl:otherwise>
> </xsl:choose>
> </xsl:variable>
>
> <xsp:logic>
> <xsl:value-of select="$class"/> _xform_<xsl:value-of select="$formname"/> = null;
> </xsp:logic>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template name="defineForms">
> <xsp:logic>
> /* START defineForms */
> </xsp:logic>
>
> <xsl:variable name="requiredforms" select=".//xform:*/@xform|.//xform:xform/@id"/>
> <xsl:for-each select="$requiredforms">
> <xsl:variable name="formname" select="."/>
> <xsl:if test="generate-id(.) = generate-id($requiredforms[.=$formname][1])">
> <xsl:call-template name="defineForm"/>
> </xsl:if>
> </xsl:for-each>
>
> <xsp:logic>
> /* STOP defineForms */
> </xsp:logic>
> </xsl:template>
>
>
><!--##################################################################################-->
>
> <xsl:template name="getForm">
> <xsl:variable name="formname" select="."/>
> <xsp:logic>
> /* XForm <xsl:value-of select="$formname"/> */
> </xsp:logic>
>
> <xsl:variable name="class">
> <xsl:choose>
> <xsl:when test="../@class"><xsl:value-of select="../@class"/></xsl:when>
> <xsl:otherwise>DOMObject</xsl:otherwise>
> </xsl:choose>
> </xsl:variable>
>
> <xsp:logic>
> _xform_<xsl:value-of select="$formname"/> = (<xsl:value-of select="$class"/>)
> _xform_session.getAttribute("<xsl:value-of select="$formname"/>");
> if(_xform_<xsl:value-of select="$formname"/> == null){
> _xform_<xsl:value-of select="$formname"/> = new <xsl:value-of
>select="$class"/>();
> getLogger().debug("xform taglib created the <xsl:value-of select="$class"/>
>[<xsl:value-of
> select="$formname"/>]");
> }
> </xsp:logic>
>
=== message truncated ===>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]