vgritsenko 02/02/02 17:22:55 Added: src/webapp/docs/samples/xsp logicsheet.xsp src/webapp/logicsheets hello.xsl Log: Add logicsheet sample Revision Changes Path 1.1 xml-cocoon2/src/webapp/docs/samples/xsp/logicsheet.xsp Index: logicsheet.xsp =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <!-- XSP can be assotiated with the logicsheet using processing instruction xml-logicsheet or the xsp:logicsheet element. <?xml-logicsheet href="logicsheets/hello.xsl"?> --> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-request="http://apache.org/xsp/request/2.0" xmlns:xsp-hello="http://apache.org/xsp/hello/1.0" ><xsp:logicsheet location="logicsheets/hello.xsl"/> <!-- Context URL can be used: <xsp:logicsheet location="context://logicsheets/hello.xsl"/> --> <page> <title>Greetings Page</title> <content> <xsp:logic> String name = <xsp-request:get-parameter name="name"/>; if (name == null) { <xsp-hello:greeting name="Unknown"/> <form action="logicsheet"> Please enter your name: <input name="name"/> <input type="submit"/> </form> } else { <b> <xsp-hello:greeting value="Welcome to this small logicsheet sample"> <xsp-hello:name><xsp:expr>name</xsp:expr></xsp-hello:name> </xsp-hello:greeting> </b> <para> This greeting above was created using simple logicsheet. </para> } </xsp:logic> </content> </page> </xsp:page> 1.1 xml-cocoon2/src/webapp/logicsheets/hello.xsl Index: hello.xsl =================================================================== <?xml version="1.0"?> <!-- ***************************************************************************** * Copyright (C) The Apache Software Foundation. All rights reserved. * * _________________________________________________________________________ * * This software is published under the terms of the Apache Software License * * version 1.1, a copy of which has been included with this distribution in * * the LICENSE file. * ***************************************************************************** --> <!-- * Hello World logicsheet for the Java language * * @author <a href="mailto:[EMAIL PROTECTED]>Vadim Gritsenko</a> * @version CVS $Revision: 1.1 $ $Date: 2002/02/03 01:22:55 $ --> <xsl:stylesheet version="1.0" xmlns:xsp="http://apache.org/xsp" xmlns:xsp-hello="http://apache.org/xsp/hello/1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="xsp-hello:greeting"> <xsl:variable name="name"> <xsl:choose> <xsl:when test="@name">"<xsl:value-of select="@name"/>"</xsl:when> <xsl:when test="xsp-hello:name"> <xsl:call-template name="get-nested-content"> <xsl:with-param name="content" select="xsp-hello:name"/> </xsl:call-template> </xsl:when> </xsl:choose> </xsl:variable> <xsl:variable name="value"> <xsl:choose> <xsl:when test="@value">"<xsl:value-of select="@value"/>"</xsl:when> <xsl:when test="xsp-hello:value"> <xsl:call-template name="get-nested-content"> <xsl:with-param name="content" select="xsp-hello:value"/> </xsl:call-template> </xsl:when> <xsl:otherwise>"Hello"</xsl:otherwise> </xsl:choose> </xsl:variable> <xsp:content> <xsp:expr><xsl:value-of select="$value"/></xsp:expr>, <xsp:expr><xsl:value-of select="$name"/></xsp:expr>! </xsp:content> </xsl:template> <xsl:template name="get-nested-content"> <xsl:param name="content"/> <xsl:choose> <xsl:when test="$content/*"> <xsl:apply-templates select="$content/*"/> </xsl:when> <xsl:otherwise>"<xsl:value-of select="$content"/>"</xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="@*|*|text()|processing-instruction()"> <xsl:copy> <xsl:apply-templates select="@*|*|text()|processing-instruction()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]