# HG changeset patch # User Paul Boddie # Date 1227228210 -3600 # Node ID 992418d0335952e2e02bdd59ff48c032f31a55b7 # Parent ce20858ccd11ee1659aac7b009c9a3f58cfadcf6 Fix API documentation links. diff -r ce20858ccd11 -r 992418d03359 docs/JavaScript-reference.html --- a/docs/JavaScript-reference.html Fri Nov 21 01:43:03 2008 +0100 +++ b/docs/JavaScript-reference.html Fri Nov 21 01:43:30 2008 +0100 @@ -12,7 +12,7 @@
'platforms'
The above example causes an update to be sent to the location platforms relative to the current page.
sourceAreasStr
A comma-separated list of regions in the form data which affect the outcome of the update. For example:
'/package$1/platforms$1'
-Typically, one would use an template extension function to provide such information. For example:
+Typically, one would use an template extension function to provide such information. For example:
'{template:other-elements(..)}'
Selector fields may be specified in addition to regions:
'{template:selector-name('remove_platform', .)}'
@@ -20,6 +20,6 @@

requestUpdate

Parameters:

url
The URL (which may be relative to the current page or resource) to which the update shall be sent. See the description of the url parameter for the requestUpdateArea function for more details.
fieldNamesStr
A comma-separated list of fields in the form data which affect the outcome of the update. For example:
'/package$1/name'
-Typically, one would use an template extension function to provide such information. For example:
+Typically, one would use an template extension function to provide such information. For example:
'{template:other-attributes('name', .)}'
The above example causes the field associated with the name attribute on the current element to be included in the update.
targetName
The element identifier (specified by an HTML or XML id attribute) within which the outcome of the update shall appear.
targetFieldNamesStr
A comma-separated list of fields in the form data which are affected by the update. See the fieldNamesStr parameter for more details.
elementPath
A simple path into the form data, defining the scope of the update.
diff -r ce20858ccd11 -r 992418d03359 docs/XSLForms-resource.html --- a/docs/XSLForms-resource.html Fri Nov 21 01:43:03 2008 +0100 +++ b/docs/XSLForms-resource.html Fri Nov 21 01:43:30 2008 +0100 @@ -11,7 +11,7 @@ from this class, XSLFormsResource, you can derive your own application-specific resources and use the class's API to obtain, manipulate and present form data. Although the -supplied API documentation provides details of the class's API, specifically in the XSLForms.Resources.WebResources module, this document attempts to explain how the API is used in practice.

Resource Structure

The structure of a Web resource derived from XSLFormsResource should look like this:

class MyResource(XSLForms.Resources.WebResources.XSLFormsResource):

[Resource definitions]

def respond_to_form(self, trans, form):
[Examine the form data, see if the user has added or removed anything.]
[Perform additional processing and initialise the form data.]
[Produce some kind of response to show the user the updated form data.]

Since XSLFormsResource builds on WebStack's resource mechanisms, we do have the transaction object, trans, available. However, most of the information we need to access and manipulate is generally available through the form object.

Defining Resources

Classes derived from XSLFormsResource +supplied API documentation provides details of the class's API, specifically in the XSLForms.Resources.WebResources module, this document attempts to explain how the API is used in practice.

Resource Structure

The structure of a Web resource derived from XSLFormsResource should look like this:

class MyResource(XSLForms.Resources.WebResources.XSLFormsResource):

[Resource definitions]

def respond_to_form(self, trans, form):
[Examine the form data, see if the user has added or removed anything.]
[Perform additional processing and initialise the form data.]
[Produce some kind of response to show the user the updated form data.]

Since XSLFormsResource builds on WebStack's resource mechanisms, we do have the transaction object, trans, available. However, most of the information we need to access and manipulate is generally available through the form object.

Defining Resources

Classes derived from XSLFormsResource support the concept of resources which are used to produce output, support processing and to provide access to useful information. At the class level it is essential to define at least some of these resources @@ -109,7 +109,7 @@ use the identifier in the above example together with config_template.xhtml, we would have to ensure that the identifier appeared as a value of an id node in that template document. Note that the choice of template document is not defined here, but is instead made when handling an -in-page update request.

Examining the Form Data

The form data is available through the form object which exposes the XSLForms.Fields.Form API. The most interesting operations are as follows:

Obtain the Form Data Documents

Since +in-page update request.

Examining the Form Data

The form data is available through the form object which exposes the XSLForms.Fields.Form API. The most interesting operations are as follows:

Obtain the Form Data Documents

Since XSLForms is an XML-based toolkit, the form data is available as XML documents which can be accessed and manipulated using a DOM-style API. Upon receiving submitted form data, XSLForms converts the data to such @@ -155,7 +155,7 @@ operation, we could use the DOM-style API exposed by the contents of the selectors to perform such an operation in the resource using our own code. However, the XSLForms toolkit provides some useful -convenience functions to assist in the removal or addition of elements:

# After doing this:
# import XSLForms.Utils

# Removing elements...

removed_elements = selectors.get("remove") # this may return None
XSLForms.Utils.remove_elements(removed_elements) # this can handle None, realising that no elements are to be removed

# Adding elements...

places_to_add_elements = selectors.get("add")
XSLForms.Utils.add_elements(places_to_add_elements, "element")

See the XSLForms.Utils documentation for more information on these functions.

Document Initialisation

The initialisation of a document, using information defined in the init_resources +convenience functions to assist in the removal or addition of elements:

# After doing this:
# import XSLForms.Utils

# Removing elements...

removed_elements = selectors.get("remove") # this may return None
XSLForms.Utils.remove_elements(removed_elements) # this can handle None, realising that no elements are to be removed

# Adding elements...

places_to_add_elements = selectors.get("add")
XSLForms.Utils.add_elements(places_to_add_elements, "element")

See the XSLForms.Utils documentation for more information on these functions.

Document Initialisation

The initialisation of a document, using information defined in the init_resources attribute, is similar to the transformation of a document as described above. First, we obtain a reference to an initialisation stylesheet:

init_stylesheet = self.prepare_initialiser("configuration")

Note that only a single stylesheet is returned. With the result of the call, diff -r ce20858ccd11 -r 992418d03359 docs/index.html --- a/docs/index.html Fri Nov 21 01:43:03 2008 +0100 +++ b/docs/index.html Fri Nov 21 01:43:30 2008 +0100 @@ -29,7 +29,7 @@ guide can be found inside the apidocs directory within the XSLTools-0.6 directory. Of course, it is always possible to view the API documentation -within Python by importing modules (such as XSLTools.XSLOutput) +within Python by importing modules (such as XSLTools.XSLOutput) and using Python's built-in help function.

About XSLForms Applications