Question

I try to see a web page with a xform in xampp-server

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:xf="http://www.w3.org/2002/xhtml">
    <head>

There is a model of the form

<xf:model>
    <xf:instance>
        <person>
            <fname />
            <lname />
        </person>
    </xf:instance>
    <xf:submission id="form1" method="get" action="submit.asp" />
</xf:model>

and there is the real form

        <xf:input ref="fname"><xf:label>First Name</xf:label></xf:input><br />
        <xf:input ref="lname"><xf:label>Last Name</xf:label></xf:input><br />
        <xf:submit submission="form1"><xf:label>Submit</xf:label></xf:submit>
    </body>
</html>

How to see the web page instead of xml-code with error message "This XML file does not appear to have any style information associated with it. The document tree is shown below." in browser? Thank you!

Was it helpful?

Solution

Sadly none of the major browsers support XForms directly. In order to see the XForms running in your browser, you'll need an XForms processor.

In your XAMPP server, the best choice is XSLTForms.

Download it from http://sourceforge.net/projects/xsltforms/ and unpack the files in a folder named xsltforms under the same folder where your page resides.

The next step is to modify your XForms to use the processor. Include the following processing instruction just behind the declaration at the top of the page:

<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl" ?>

XSLTForms uses an XSL transformation to convert your XForms into an HTML5 form usable by your browser, with a little help of Javascript to handle the XForms behavior.

You can find more information in the XSLTForms website and the wikibook.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top