You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michael Bierenfeld <mi...@atmiralis.de> on 2000/04/11 12:27:28 UTC

User Input handling. Any proposals !

Hello,

we are implementing a new Application Framework with Cocoon. The
previous Framework was based on Servlets, HTML-Templates and a small
Precompiler that generates small Beans for Databaseaccess. Now I am
struggeling a little bit with User Input I have the following
xml-structur, Stylesheets and xsp-defs.

login.xml. (Page to be displayed)
---------------------------------

<?xml-stylesheet href="../xsp/at_tools.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>
<!--
************************************************************************
-->
<page title="Login Maske" stylesheet="../xsl/menu_page_html.xsl">
<!--
************************************************************************
-->
<body>

	<form>
	
		<row>
			<input name="sUserName" datatype="String">
				Username : 
			</input>

			<input name="sUserPassword" datatype="String">
				Userpassword : 
			</input>
		</row>
		<row>
			<button image="/Projekte/Voith/html/Pictures/buttons/OK-25x60.gif">
			
				<counter/>		
	
			</button>
		</row>
	</form>
</body>


at_tools.xsl        (XSP Defs)
-------------------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>

  <!--
**************************************************************************
-->
  <!-- Einstiegspunkt für die Seite zu verwendendes XSLT als parameter
stylesheet -->

  <xsl:template match="page">

    <!--
*********************************************************************
-->
    <!-- Processing
instructions                                               -->

    <xsl:processing-instruction name="cocoon-process">
	type="xsp"
    </xsl:processing-instruction>

    <xsl:processing-instruction name="cocoon-process">
	type="xslt"
    </xsl:processing-instruction>
    
    <!--
***********************************************************************
-->
    <!-- Definition des zu verwendenden
Stylesheets                              -->

    <xsl:processing-instruction name="xml-stylesheet">

	href=<xsl:text>"</xsl:text><xsl:value-of
select="@stylesheet"/><xsl:text>"</xsl:text>

	type="text/xsl"
    </xsl:processing-instruction>

    <xsp:page>

	<!--
******************************************************************** -->
	<!-- Java Logic bitte hier
definieren                                     -->

	<xsp:logic>

		static private int counter = 0;

		private synchronized int counter () {

			int retValue = counter ++;

			return retValue;
		}

	</xsp:logic>

	<xsl:copy>
		<xsl:apply-templates select="@*|node ()"/>
	</xsl:copy>

    </xsp:page>

  </xsl:template>

  <!--
*************************************************************************
-->
  <!-- Eigens verwendete Tags die nicht aus dem Stylesheet
kommen                -->

  <xsl:template match="counter">

	<xsp:expr> counter () </xsp:expr>

  </xsl:template>

  <!--
**************************************************************************
-->
  <!-- Die anderen Templates muessen natürlich auch noch ausgeführt
werden        -->

  <xsl:template match="@*|node()">

	<xsl:copy>
		<xsl:apply-templates select ="@*|node()"/>
	</xsl:copy>

  </xsl:template>

</xsl:stylesheet>



input.xsl (Part of the XSLT Definition)
----------------------------------------

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!--
**********************************************************************
-->
<!-- Eingabe Elemente -->

<xsl:template match="input">

	<xsl:apply-templates/>
	<input name="{@name}" type="text"/>

</xsl:template>

<!--
**********************************************************************
-->
<!-- Form Tag einfuehren -->

<xsl:template match="form">
	<td>
		<form>
			<xsl:apply-templates/>
		</form>		
	</td>
</xsl:template>

<!--
**********************************************************************
-->
<!-- Button Tag -->

<xsl:template match="button">
	<td>
		<a href="{@href}"><img src="{@image}"
border="0"/><xsl:apply-templates/></a>
	</td>
</xsl:template>

<!--
**********************************************************************
-->
<!-- Row Tag -->

<xsl:template match="row">
	<table><tr>
		<xsl:apply-templates/>
	</tr></table>
</xsl:template>

</xsl:stylesheet>


What I am trying to implement is some sort of a button tag. But I don't
have a single Idea how to do that. Has this or something similar ever
been implemented by someone else. Any
tips examples would be greatly appretiated.

Regards

Michael