XSLTForms/Form not correctly rendered
There may be many reasons a form is not correctly rendered.
For XForms embedded in XHTML documents, the following causes are common and easy to check for.
1. Bad MIME type
For XForms embedded in HTML documents, one common reason is that the document in question is being served with MIME type text/html
instead of application/xml
, text/xml
, application/xhtml
, application/xhtml+xml
, or another appropriate MIME type. [Cross reference to proper discussion of XForms MIME types needed here.]
When the document is served with an XML-related MIME type recognized by the browser, the browser will apply the XSLTForms stylesheet, which transforms the form into XHTML which the browser will understand natively, plus Javascript functionality to produce the prescribed XForms behaviors. When the document is served without an appropriate MIME type, no transformation will be undertaken, and the XForms controls will typically not be rendered.
The final control over what MIME type is associated with a document served by a Web server lies within the server's configuration. If you understand how to configure your server, you can control it however you like. If you don't, then the easiest approach is to rename the form from myform.html
to myform.xhtml
or myform.xml
. This exploits the common default associations of MIME types with file extensions.
Renaming the file also typically works for documents in the file system.
2. No xml-stylesheet processing instruction
Make sure you have a stylesheet pointer, with a form something like:
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
3. xsltforms.xsl not found
Make sure the href
pseudo-attribute in your xml-stylesheet
processing instruction points to the right place.