1.1 --- a/XSLForms/Output.py Sat Nov 05 01:46:04 2005 +0000
1.2 +++ b/XSLForms/Output.py Tue Nov 08 18:32:55 2005 +0000
1.3 @@ -123,6 +123,7 @@
1.4
1.5 """
1.6 Exposed as {template:this-element()}.
1.7 +
1.8 Provides a reference to the current element in the form data structure.
1.9 """
1.10
1.11 @@ -134,6 +135,7 @@
1.12
1.13 """
1.14 Exposed as {template:this-attribute()}.
1.15 +
1.16 Provides a reference to the current attribute in the form data structure.
1.17 """
1.18
1.19 @@ -145,6 +147,7 @@
1.20
1.21 """
1.22 Exposed as {template:new-attribute(name)}.
1.23 +
1.24 Provides a reference to a new attribute of the given 'name' on the current
1.25 element in the form data structure.
1.26 """
1.27 @@ -158,6 +161,7 @@
1.28
1.29 """
1.30 Exposed as {template:other-elements(nodes)}.
1.31 +
1.32 Provides a reference to other elements in the form data structure according
1.33 to the specified 'nodes' parameter (an XPath expression in the template).
1.34 """
1.35 @@ -175,6 +179,7 @@
1.36
1.37 """
1.38 Exposed as {template:list-attribute(element_name, attribute_name)}.
1.39 +
1.40 Provides a reference to one or many elements of the given 'element_name'
1.41 found under the current element in the form data structure having
1.42 attributes with the given 'attribute_name'.
1.43 @@ -190,6 +195,7 @@
1.44
1.45 """
1.46 Exposed as {template:other-list-attributes(element_name, attribute_name, nodes)}.
1.47 +
1.48 Provides a reference to other elements in the form data structure, found
1.49 under the specified 'nodes' (described using an XPath expression in the
1.50 template) having the given 'element_name' and bearing attributes of the
1.51 @@ -211,6 +217,7 @@
1.52
1.53 """
1.54 Exposed as {template:other-attributes(name, nodes)}.
1.55 +
1.56 Provides a reference to attributes in the form data structure of the given
1.57 'attribute_name' residing on the specified 'nodes' (described using an XPath
1.58 expression in the template).
1.59 @@ -233,6 +240,7 @@
1.60
1.61 """
1.62 Exposed as {template:child-element(element_name, position, node_paths)}.
1.63 +
1.64 Provides relative paths to the specifed 'element_name', having the given
1.65 'position' (1-based) under each element specified in 'node_paths' (provided
1.66 by calls to other extension functions in the template). For example:
1.67 @@ -251,6 +259,7 @@
1.68
1.69 """
1.70 Exposed as {template:child-attribute(attribute_name, node_paths)}.
1.71 +
1.72 Provides a relative path to the specifed 'attribute_name' for each element
1.73 specified in 'node_paths' (provided by calls to other extension functions in
1.74 the template). For example:
1.75 @@ -268,6 +277,7 @@
1.76
1.77 """
1.78 Exposed as {template:selector-name(field_name, nodes)}.
1.79 +
1.80 Provides a selector field name defined using 'field_name' and referring to
1.81 the given 'nodes'. For example:
1.82
1.83 @@ -310,6 +320,7 @@
1.84
1.85 """
1.86 Exposed as {template:url-encode(nodes)}.
1.87 +
1.88 Provides a "URL encoded" string created from the merged textual contents of
1.89 the given 'nodes', with the encoded character values representing characters
1.90 in the optional 'charset' (UTF-8 if not specified).
1.91 @@ -327,11 +338,22 @@
1.92 def element_path(context, field_names):
1.93
1.94 """
1.95 + Exposed as {template:element-path(field_names)}.
1.96 +
1.97 Convert the given 'field_names' back to XPath references.
1.98 For example:
1.99 +
1.100 /configuration$1/details$1/base-system$$value -> /*[position() = 1]/*[position() = 1]/base-system
1.101 +
1.102 If more than one field name is given - ie. 'field_names' contains a
1.103 comma-separated list of names - then only the first name is used.
1.104 +
1.105 + To use this function effectively, use the result of another function as the
1.106 + argument. For example:
1.107 +
1.108 + template:element-path(template:this-element())
1.109 + template:element-path(template:other-elements(matches))
1.110 + template:element-path(template:other-elements(..))
1.111 """
1.112
1.113 field_name = field_names.split(",")[0]