Jump to content

XForms & XSLT


kwilliams

Recommended Posts

I'm trying to learn about the use of XForms with XSLT, and I'm having some difficulties figuring it out. My site transforms an XML and XSLT doc into a resulting HTML doc using the following ASP.NET code:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" AspCompat="true" Debug="true" %><%@ import Namespace="System.Web" %><%@ import Namespace="System.Web.UI" %><%@ import Namespace="System.Web.UI.WebControls" %><%@ import Namespace="System.Web.UI.HtmlControls" %><%@ import Namespace="System.Xml" %><%@ import Namespace="System.Xml.Xsl" %><%@ import Namespace="System.Xml.XPath" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script language="vb" runat="server">	Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)		xslTransform.DocumentSource = "xmldoc.xml"		xslTransform.TransformSource = "xsldoc.xsl"	End Sub</script><html><body><form id="form1" runat="server">		<div id="wrapper">			<asp:Xml id="xslTransform" runat="server"></asp:Xml>		</div><!--end wrapper--></form></body></html>

I want to create forms for the site, and I'd like to look into using XForms for this purpose. Is it the best solution for my setup? Also, if someone could point me in the right direction to some simple XForm examples, that would be great. Thanks.P.S. My site uses a XSLT 1.0 Processor.

Link to comment
Share on other sites

Wow, no replies. Well, I'll try again in a more straightforward manner:1) Can I use XForms with an ASP.NET transformation of XML/XSLT docs (see code in previous post)?2) If so, where would some good resources be of this setup?3) If not, what would be an alternative solution?Thanks for any help.

Link to comment
Share on other sites

Sorry. I had been very bussy this week, and there are very few people that look into the XSLT forum but me (and I'm not braggin unfrortunatly).XForms are a client side alternative of the simple HTML forms. In other words, they are processed on the client side. That said, you don't need any special server setup to produce XForms. The bad news of this is that the client needs a special setup. It needs a plug-in that differs from browser to browser to be exact.If you're VERY creative, you might be able to create an XSLT that will covert XForms to HTML forms+JS, but that's a lot of work.The other current solution is to use FormFaces. It's a JS library that turns XForms in HTML files into HTML forms+JS, but you must know HTML files having XForms become invalid because of that.As for XSLT. It's not an obstacle at all. XSLT only takes one code and turns it into another one. So whatever you can write in an XML based file, you can also use as output (and input for that matter) for XSLT.

Link to comment
Share on other sites

Sorry. I had been very bussy this week, and there are very few people that look into the XSLT forum but me (and I'm not braggin unfrortunatly).XForms are a client side alternative of the simple HTML forms. In other words, they are processed on the client side. That said, you don't need any special server setup to produce XForms. The bad news of this is that the client needs a special setup. It needs a plug-in that differs from browser to browser to be exact.If you're VERY creative, you might be able to create an XSLT that will covert XForms to HTML forms+JS, but that's a lot of work.The other current solution is to use FormFaces. It's a JS library that turns XForms in HTML files into HTML forms+JS, but you must know HTML files having XForms become invalid because of that.As for XSLT. It's not an obstacle at all. XSLT only takes one code and turns it into another one. So whatever you can write in an XML based file, you can also use as output (and input for that matter) for XSLT.
Thanks for the reply boen_robot. It makes more sense to me now. Since I'm using a server-side solution of transforming XML & XSLT with ASP.NET, XForms obviously isn't the best solution for my site. I guess I'll have to work with a more basic forms solution.But I was wondering about using an XML schema for forms validation site-wide. If I created an XML schema for form uniformity, and I loaded it automatically for every form, could it display error messages upon an incorrectly-completed form as ASP could do? Or is the whole thing handled in a completely different way? I'm sorry to ask what are likely such easy-to-answer questions, but I'm still learning. So if you could let me know if this is possible, and point me in the right direction if it is, that would be great. Thanks for all of your help.
Link to comment
Share on other sites

Well, you're kind'a right.XForms can use Schema data types to determine whether a certain user input is valid or not. The client itself can verify the data against the corresponding data type and decide what to do (refuse to send the form and/or display an error message, etc.). The server can use the EXACT same schema to verify that EXACT same data, ensuring security. If you want to change what's valid in your form, you wuld only have to edit the shcema file, instead of editing tons of both ASP and JS.

Link to comment
Share on other sites

Well, you're kind'a right.XForms can use Schema data types to determine whether a certain user input is valid or not. The client itself can verify the data against the corresponding data type and decide what to do (refuse to send the form and/or display an error message, etc.). The server can use the EXACT same schema to verify that EXACT same data, ensuring security. If you want to change what's valid in your form, you wuld only have to edit the shcema file, instead of editing tons of both ASP and JS.
Ok, that helps me to make more sense of the setup. I'll continue working on it, and I'll let you know of the outcome of that work. Thanks again for all of your thorough answers...it's greatly appreciated.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...