# HG changeset patch # User paulb # Date 1131996819 0 # Node ID a84e3b78b606b5ddfe3c2370857aeef9cb823f6f # Parent 6f7ef4363ea96cb08c815ea2634d9edefee24efb [project @ 2005-11-14 19:33:39 by paulb] Changed "XSLT/template" to "template extension" in the context of functions in stylesheets. Added an advanced template design document which describes the relationship between templates and XSLT. diff -r 6f7ef4363ea9 -r a84e3b78b606 docs/JavaScript-reference.html --- a/docs/JavaScript-reference.html Fri Nov 11 17:14:22 2005 +0000 +++ b/docs/JavaScript-reference.html Mon Nov 14 19:33:39 2005 +0000 @@ -5,4 +5,4 @@ JavaScript Function Reference -

JavaScript Function References

The following JavaScript functions are available for the triggering of in-page updates:

requestUpdateArea

Parameters:

url
The URL (which may be relative to the current page or resource) to which the update shall be sent. For example:
'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 XSLT/template function to provide such information. For example:
'{template:other-elements(..)}'
Selector fields may be specified in addition to regions:
'{template:selector-name('remove_platform', .)}'
The above example causes the remove_platform selector field 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.
targetAreasStr
A comma-separated list of regions in the form data which are affected by the update. See the sourceAreasStr parameter for more details.
elementPath
A simple path into the form data, defining the scope of the update.

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 XSLT/template 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.
\ No newline at end of file +

JavaScript Function References

The following JavaScript functions are available for the triggering of in-page updates:

requestUpdateArea

Parameters:

url
The URL (which may be relative to the current page or resource) to which the update shall be sent. For example:
'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:
'{template:other-elements(..)}'
Selector fields may be specified in addition to regions:
'{template:selector-name('remove_platform', .)}'
The above example causes the remove_platform selector field 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.
targetAreasStr
A comma-separated list of regions in the form data which are affected by the update. See the sourceAreasStr parameter for more details.
elementPath
A simple path into the form data, defining the scope of the update.

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:
'{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.
\ No newline at end of file diff -r 6f7ef4363ea9 -r a84e3b78b606 docs/advanced.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/advanced.html Mon Nov 14 19:33:39 2005 +0000 @@ -0,0 +1,71 @@ + + + + + Advanced Template Design + + +

Advanced Template Design

+

In the "Template Design" document, the special XSLForms annotations +were presented as a means to display the information contained in form +data documents (or just general XML documents with no special +connection to Web forms). However, since XSLForms templates build upon +XSL transformations, it is also possible to employ certain XSL +techniques to present the information in various different ways.

Templates and Transformations

When +"prepared", XSLForms templates are converted to XSL stylesheets, and +when form data is "displayed", such XSL stylesheets are used to +transform the form data to a representation which looks like the +original template, but with different parts of the template populated +with the "displayed" form data. The process can be illustrated as +follows:

+ + + + + + + + + + + + + + + + + + + +
Template
+ + A template presents the general form of the final output.
Stylesheet
+ + Templates are converted to stylesheets, which are like programs specially designed to present XML information.
Output
+ + The final output is produced when a stylesheet is combined with an XML document.

Since the stylesheet is based on XSL, which is a rich +language in its own right, advanced template design techniques can +involve some of the features of XSL - at least those which do not +affect the simplicity or general structure of our templates.

Template Extension Functions and Variables

One +area where XSL features are already employed to affect the final output +in XSLForms is in the toolkit's use of template extension +functions and special variables - the latter being used in the output +production process. For example, we might decide to use the lower level +template functions to present the value of an attribute:

<span template:attribute="some-attribute" template:value="$this-value">xxx</span>

In the above example, we reference the special variable $this-value which refers to the value of some-attribute. An example of template functions in use looks like this:

<span id="{template:this-element()}">xxx</span>

In the above example, we invoke the template function template:this-element +in order to create a unique identifier in the final output. Since we +use the function inside an attribute which is not prefixed with template, we must enclose the expression between { and } characters.

Beyond Template Extension Functions

Since +the above template extension functions and variables are merely special in the +sense that XSLForms provides them to produce its output, and since they +are accessed in the stylesheet using normal XSL-based mechanisms, there +is no technical barrier to using other kinds of valid XSL (or more +precisely, XPath) expressions in cases such as those given above. The +rules for using such expressions in attributes are straightforward:

Here is a trivial example of the usage of an XPath expression, based on one of the above examples:

<span template:attribute="some-attribute" template:value="string-length($this-value)">xxx</span>

In the above example, we invoke the standard XPath function string-length in order to produce within the span element the length of the value of some-attribute (instead of the actual value).

More +interesting applications of XPath expressions and non-XSLForms +functions arise when using more of the potential of XPath to select +arbitrary elements and attributes and to perform calculations on the +selected nodes. The following example originates from the Configurator +example application:

<span template:value="sum(/configuration//*[@value-is-set]/@price) + sum(/configuration//*[@value = ../@value]/@price)"></span>

This complicated expression, to be inserted within the span element, finds all elements in the system configuration having the value-is-set +attribute and adds their prices together; this total is combined with +the sum of the prices from all elements marked as selected in their +respective lists. In other words, it gets the total of all selected +components and inserts it into the final output.

\ No newline at end of file diff -r 6f7ef4363ea9 -r a84e3b78b606 docs/overview.html --- a/docs/overview.html Fri Nov 11 17:14:22 2005 +0000 +++ b/docs/overview.html Mon Nov 14 19:33:39 2005 +0000 @@ -6,7 +6,9 @@

Creating Applications: An Overview

-

The following steps briefly describe how to make a new application:
+

This document contains an overview of the process of developing an +XSLForms application. Since the only currently supported way of +deploying such an application is through the use of WebStack, it is necessary to install that package first before following the tutorial below.

The following steps briefly describe how to make a new application:

  1. Create a directory to hold your files
  2. @@ -20,5 +22,5 @@
  3. Adding multivalued fields
  4. Recommendations and advice
  5. Adding in-page updates
  6. -

A topic-by-topic guide to XSLTools:

Some other resources:

+

A topic-by-topic guide to XSLTools:

Some other resources:

\ No newline at end of file