Jump to content

XForms/Template

From Wikibooks, open books for an open world

Motivation

[edit | edit source]

Why are you creating this example? Should start with "You want to..."

Screen Image

[edit | edit source]

A sample screen image. Many people do not have the ability to run the examples so this is critical.

Use this format:

File:My-screen-image.jpg
This is my caption

Make SURE you label all images with a license. Please use creative commons share alike with attribution if you can.

Sample Code

[edit | edit source]
  • Please make the default namespace xhtml.
  • Please use the xf as the namespace prefix for all XForms elements.
  • Use spaces to indent, not tabs. Wikimedia and browsers use different setting for tab-stops. This can not be changed.
  • Wrap your source code using the source element to give the code syntax highlighting:
   <syntaxhighlight lang="xml">
   ...
   </syntaxhighlight>

Sample XForms Template

[edit | edit source]
<html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ev="http://www.w3.org/2001/xml-events"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xmlns:xf="http://www.w3.org/2002/xforms">
   <head>
       <title>Form Title</title>
       <style type="text/css">
          @namespace xf url("http://www.w3.org/2002/xforms");
          body {font-family:Helvetica, sans-serif;}
       </style>
       <xf:model>
          <xf:instance xmlns="">
            <data>
               <my-element>Hello World</my-element>
            </data>
          </xf:instance>
       </xf:model>
    </head>
    <body>
         <xf:input ref="my-element">
            <xf:label>Message: </xf:label>
         </xf:input>
    </body>
</html>

Auto navigation macro

[edit | edit source]

Please place the following macro at the end of each example:

{{auto navigation|NextExample|PriorExample}}


This allows readers to just page through the examples without using the back button.

Discussion

[edit | edit source]

Some analysis of the more difficult or unusual sections of the example. Any long complex XPath expressions should be explained on a step-by-step basis.

Credits

[edit | edit source]

Make sure you give credits to other examples that people have done. Our license is Sharealike with Attribution so we want to also give other developers attribution if they started some examples. Give a URL to the original author's code if you can.

Next Page: NextExample | Previous Page: PriorExample
Home: XForms