W3C home > Mailing lists > Public > www-forms@w3.org > August 2002

RE: xforms in xhtml, styled using xsl?

From: Dan Dennedy <DDennedy@digitalbang.com>
Date: Fri, 16 Aug 2002 16:02:12 -0400
Message-ID: <11DC9B322580C843AE5A3D030D950B030315A3@intrabang01.digitalbang.com>
To: "alex" <shortestpath@yahoo.com>, <www-forms@w3.org>

> From: alex 
> 
> does anyone know of an example out there that uses 
> xforms in xhtml, and styled one the client side with 
> xsl?
> 
Do you imply that the xforms processor is on the client or server? If on
the server, then most examples would use css with xhtml rather than
xslt. There is not much value in using xslt to style xhtml; typically
xslt is used on the client to style other xml. There are only a few
public xforms implementations. x-smiles has a few examples of using
xhtml, xforms, and css.

There are some public server-side implementations that use xslt as part
of the processor, but I don't know much details. For instance, Chiba1
seems to only support standalone xforms docs, while Chiba2 supports
xhtml+xforms (but not xslt+xhtml+xforms?). Apache (Cocoon?) is working
on something too.

My personal, private server-side processor under development does allow
one to combine xhtml with xforms and xslt. It has a xslt pre-processing
stage that let's one use xhtml+xforms inside an xslt. First, any
external references to instance data are expanded and run against the
document using xslt to generate xhtml+xforms. Then, the processor
processes the xforms in the result creating an expanded and extended
xhtml+xforms. That result is run through another xslt into xhtml+css.
This lets one author in the familiar model of xml data + xslt to output
xhtml+css. The last xslt stage offers some flexibility in how the
processor generates its xhtml because the xslt can be swapped out with a
variation--just in case.

ok, here is my example:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	version="1.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xforms="http://www.w3.org/2002/01/xforms"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	>
	<xsl:output method="xml" version="1.0" indent="yes"/>
	<xsl:template match="xforms:instance">
		<html>
		<head>
			<title>Edit User</title>
			<xforms:model id="user">
				<xforms:submitInfo id="submitUser"
action="success.html" replace="all"/>
				<xforms:schema
xlink:href="/schema/user.xsd"/>
				<xforms:instance
xlink:href="xmldb:foo.com#xpointer(root/users/user)"/>
				<xforms:bind ref="lastname"
required="true()"/>
			</xforms:model>
		</head>
		<body>
			<xforms:group model="user">
				<xforms:caption>Edit User
Information</xforms:caption>
				<xforms:input ref="firstname" cols="60">
					<xforms:caption>First
Name:</xforms:caption>
				</xforms:input>
				<xforms:input ref="lastname" cols="60">
					<xforms:caption>Last
Name:</xforms:caption>
				</xforms:input>
			</xforms:group>
			<xforms:button>
	
<xforms:caption>Register</xforms:caption>
				<xforms:action>
					<xforms:setValue
ref="@status">active</xforms:setValue>
					<xforms:submitInstance
submitInfo="submitUser"/>
				</xforms:action>
			</xforms:button>
		</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

-------------

A couple of implementation notes... 

1. I use the submitInfo/@action to specify where to go next after a
successful post. The form actually always posts back to itself to invoke
the processor. This is effectively the same as action specifying a form
handler whose response body is some new page anyway.

2. My instance points to an xml database (persistent dom) that I am also
working on.
Received on Friday, 16 August 2002 16:03:02 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:21:51 GMT