411 REFERENCE · Wikibooks
XSLTForms/Javascript
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Warning!! This documentation is automatically generated from embedded comments in Javascript sources.
XSLTForms Javascript parts are activated just after the XSLT transformation performed by the browser.
The "init()" function is created by the XSLT transformation according to the XForms document, with "xforms.init()" as the last function call, and called by the "onload" event associated with the "body" element.
Many Javascript objects and functions can be called directly by developers for specific purposes considering that misuse can compromise the XSLTForms global behavior.
Main functions and objects
"$" function
Shortcut for document.getElementById()
How does this work if we also want to include JQuery functions. Should a different function be used?
"Core" class
Core class for browsers compatibility
isOpera, isIE and isMozilla methods : return browser family
hasClass method : tests if an element has a CSS class
loadProperties method : AJAX method to get I18N properties
constructURI method : construct URI according to current location
createElement method : creates a DOM element and, optionally, add a class, attach it to its parent and fill it with a text content
getWindowSize method : obtains window size for various browsers
openRequest method : opens an XMLHttpRequest
"DebugConsole" class
Debug Console Management
write method : adds a text to the Debug Console
clear method : clears the Debug Console
"Dialog" class
Dialog Panel Management
show method : displays the Dialog Panel
hide method : hides the Dialog Panel
knownSelect method : determines whether a select control is already known by Dialog management (IE6 workaround)
showSelects method : shows/hides the selects controls under the Dialog Panel (IE6 workaround)
"Event" class
Event Management
"I8N" class
Internationalization Management
get method : get a property value for the current language
parse method : data parsing according to a pattern and the current language
format method : data formatting according to a pattern and the current language
parseDate method : direct method for date parsing
formatDate method : direct method for date formatting
formatNumber method : direct method for number formatting
parseNumber method : direct method for number parsing
Miscellaneous functions
forEach function : Convenient way to the same method with the same arguments to a collect of objects
assert function : Conditional Debug Console message adding
inArray function : Tests if a value is present in an array
zeros function : left or right zero-padding
getValue function : gets a node value
setValue function : sets the value of a node
run function : executes an action (called by generated Javascript instructions)
getId function : gets the id of the xf element concerned by en event (FF2 compatibility problem)
show function : show/hide an element (called by generated Javascript instructions, typically used for hints or input errors)
trim method : left and right trim method for String class
copyArray function : copy every element in a source array into a dest array
"xforms" class
Global class for XForms Management
init method : called from the generated init() function called at onload event
close method : performs every closing actions
openAction method : simply clears the Debug Console
closeAction method : calls the closeChanges() method when every action has been performed
closeChanges method : rebuild or recalculate after changes
error method : XForms error management
refresh method : XForms refresh management
build method : XForms build management
addChange method : builds a stack of elements concerned with changes
dispose method : disposes of an element
blur method : focus out management
"Binding" class
XForms Binding Management
constructor function : "xpath", "model" and "bind" properties are resolved
evaluate method : evaluates the binding
"IdManager" class
Id Manager for repeat structures
XForms Model Management
Each Model component is stored as a Javascript object created by the XSLT transformation.
The XFCoreElement is the parent class for all other classes.
"XFCoreElement" class
Parent class for each Model component class
init method : creates a "span" element under the "head" element to store this object
dispose method : clears the properties of this object
"XFModel" class
constructor function : specifically gets the associated schemas
addInstance method : adds an instance to this model
addBind method : adds a binding to this model
dispose method : clears the properties of this object
getInstance method : gets an instance of this model by its id
getInstanceDocument method : gets the document of an instance of this model by the instance id
findInstance method : finds the corresponding instance of a node in this model
construct method : construct step is forwarded to instances and corresponding XForms events are dispatched
reset method : reset action is forwarded to instances and this model is tagged as rebuilded
rebuild method : refresh action is forwarded to instances and the "xforms-recalculate" event is dispatched
recalculate method : recalculate action is forwarded to instances and the "xforms-revalidate" event is dispatched
revalidate method : revalidate action is forwarded to instances and the "xforms-refresh" event is dispatched
refresh method : no action
addChange method : stacks this model as changed according to current step
setRebuilded method : stores the rebuilded state according to current step
"XFInstance" class
Instance Class
constructor function : stores the properties of this instance and attaches it to a model
dispose method : clears the properties and recycles the associated nodes
construct method : loads the source of this instance locally or remotely
reset method : simply restores the initial copy of this instance
store method : clones the document of this instance
setDoc method : sets a document for this instance
revalidate method : recursively revalidates each node of this instance according to readonly and relevant attributes
"XFBind" class
Model Binding Class
constructor function : resolve all the properties and attach this object to the model
refresh method : completely evaluates and refreshes this binding
recalculate method : just recalculates this binding
"XFSubmission" class
Submission Class
constructor function : store the properties of this submission and attaches it to a model
submit method : submits serialized data according to chosen method
toUrl_ method : recursively collects node values to add them to an URL
"XFProcessor" class
Internal XForms Processor Class
error function : displays an error
XForms Action Management
Each action is stored as a Javascript object created by the XSLT transformation.
The XFAbstractAction is the parent class for all action classes.
"XFAbstractAction" class
Parent class for each Action class
init method : "if" and "while" attributes are defined in this class
execute method : "while" attribute process calling "if" attribute process
exec_ method : "if" attribute process calling specific "run" method
run method : Empty method to be defined in each sub-class
"XFAction" class
Action Class
constructor function : specifically initializes at no child
add method : adds a child action to this action
run method : executes each child action of this action
"XFDelete" class
Delete Action Class
constructor function : resolves the properties of this delete action
run method : executes this delete action and dispatches "xforms-delete"
"XFDispatch" class
Dispatch Action Class
constructor function : stores specific properties
run method : dispatches an XForms event
"XFInsert" class
Insert Action Class
constructor function : resolves specific properties
run method : clones then inserts a new element and dispatches the "xforms-insert"
"XFLoad" class
Load Action Class
constructor function : stores specific properties
run method : opens a new window or changes current location according to "show" attribute
"XFMessage" class
Message Action Class
constructor function : stores specific properties
run method : displays an alert message box containing a node value
"XFSetindex" class
SetIndex Action Class
constructor function : resolves specific properties
run method : sets the current index of a repeat structure
"XFSetvalue" class
SetValue Action Class
constructor function : resolves specific properties
run method : sets the value of a node and records it in the changes collection
"XFToggle" class
Toggle Action Class
constructor function : stores specific property
run method : toggles on the associated element
toggle method : toggles on the element according to its id and dispatches the "xforms-deselect" event
XForms Controls Management
Each control is stored as a Javascript object created by the XSLT transformation with the id of the corresponding (X)HTML element as a property.
The XFElement is the parent class for all action classes, having the XFControl class as intermediate for most of them.
"XFAVT" class
AVT Control Class
constructor function : initializes specific properties and initializes focus and blur event management
clone method : creates a new output control with the given id
dispose method : clears properties of this control and calls the parent dispose() method
setValue method : sets the value of this AVT control
"XFElement" class
Element Class
constructor function : empty
init method : initializes properties
dispose method : clears properties of this element
build method : abstractly builds this element from dependencies
"XFControl" class
Control Class
constructor function : just sets this element as a control
initFocus method : attaches event handlers for "focus" and "blur"
dispose method : calls the parent "dispose()" method
focus method : manages focus and dispatches the "DOMFocusIn" event
build_ method : specific build method updating dependencies
refresh method : refreshes this control according to the value of the corresponding node and dispatches according events
changeProp method : changes a property, such as required, relevant, readonly and valid, of this control
valueChanged method : changes the value of this control and dispatches the "xforms-recalculate" event
getXFElement function : gets the ancestor-or-self XFElement value for an element
focusHandler function : focus handler
blurHandler function : blur handler including a delay
"XFGroup" class
Group Element Class
constructor function : sets specific properties
clone method : creates a new group with the given id
build_ method : specific build method
refresh method : sets "xforms-disabled" CSS class
"XFInput" class
Input Control Class
constructor function : initializes specific properties including aid button management
clone method : creates a new input with the given id
dispose method : clears properties of this element and calls the parent dispose() method
initInput method : initializes the input control according to its type (password/textarea/boolean/date/datetime)
setValue method : sets the value of this input control according to its type
changeReadonly method : changes the read only state of this input control
initEvents method : initializes the event management according to incremental capability
blur method : manages the blur event when not in incremental mode
click method : manages the click event according to the input control type
keyUpInputMode function : updates this input control value after key up
keyUpActivate function : checks if Enter key was pressed to dispatch DOMActivate
keyUpIncrementalActivate function : checks if Enter key was pressed to dispatch DOMActivate in incremental mode
keyUpIncremental function : updates this input control value after key up in incremental mode
InputMode functions set : specific check function for each possible input mode (lowerCase/upperCase/titleCase/digits)
"XFItem" class
Item Control Class
constructor function : initializes specific properties and initializes focus and blur event management
clone method : creates a new item control with the given id
dispose method : clears properties of this element and calls the parent dispose() method
build_ method : specific build method according to label and value bindings
refresh method : refreshes the label and the value for this item control depending whether it has a rendering as option or not
click method : manages the click event according to the item control type
"XFItemset" class
ItemSet Control Class
constructor function : initializes specific properties
build_ method : specific build method with the corresponding clones creation
refresh method : sets "xforms-disabled" CSS class
clone method : creates a new itemset control with the given id
refresh_ method : refreshes this ItemSet Control at a given position
"XFLabel" class
Label Element Class
constructor function : initializes specific properties
clone method : creates a new label element with the given id
build_ method : specific build method
refresh method : refreshes this label element
"XFOutput" class
Output Control Class
constructor function : initializes specific properties and initializes focus and blur event management
clone method : creates a new output control with the given id
dispose method : clears properties of this control and calls the parent dispose() method
setValue method : sets the value of this output control
getValue method : sets the value of this output control
"XFRepeat" class
Repeat Element Class
constructor function : sets specific properties
dispose method : clears properties of this element and calls the parent dispose() method
setIndex method : sets the current index for this repeat element
deleteNode method : deletes the given node within this repeat element and makes sure that the current index is still valid
insertNode method : inserts the given node after another given node within this repeat element and updates the current index
build_ method : recreates every nodes within this repeat control and sets the current index at 1
refresh method : refreshes this repeat element and the child elements if it is not an ItemSet
clone method : creates a new repeat element with the given id
initClone function : initializes a clone for the given id
selectItem function : set the current index at the given element within a repeat element
"XFSelect" class
Select/Select1 Control Class
constructor function : initializes specific properties and initializes focus and change event management
clone method : creates a new select/select1 control with the given id
dispose method : clears properties of this select/select1 control and calls the parent dispose() method
focusFirst method : sets focus to the first item in this select/select1 control
setValue method : searches for the given value and checks it if found or dispatches the "xforms-in-range" event
changeReadonly method : changes the read only state of this select/select1 control
itemClick method : dispatches "xforms-select" and "xforms-deselect" events
blur method : blur event management
normalChange function : handler for normal mode on change dispatching "xforms-select" and "xforms-deselect" events
incrementalChange function : handler for incremental mode on change calling normal mode handler
getSelected method : collects selected options for this select/select1 control
"XFTrigger" class
Trigger Control Class
constructor function : initializes specific properties and initializes focus event management
setValue method : empty
clone method : creates a new trigger control with the given id
click method : dispatches a "DOMActivate" event
blur method : empty
"Calendar" class
Calendar Class for Date/DateTime Control
constructor function : dynamically creates a table element
today method : sets the value of this Calendar object to the current date
refreshControls method : refreshes this Calendar object according to a given date
refresh method : refreshes this Calendar object
getFirstDay method : gets the first day of the selected month
getDaysOfMonth method : gets the number of days of the selected month
createElement method : creates a new clickable day within this Calendar object
show function : shows a Calendar object of a given type for a given input
close function : hides the current Calendar object
XML Schema Management
Each Schema is stored as a Javascript object created by the XSLT transformation.
The Type is the parent class for *Type classes.
"Type" class
Type Abstract Class
constructor function : empty
setSchema method : associates a schema to this Type object
setName method : associates a name to this Type object and updates the schema accordingly
canonicalValue method : computes the canonical value according to white space management (replace, collapse)
getMaxLength method : get the max length for this Type object or null
getDisplayLength method : get the display length for this Type object or the max length is not defined
"Schema" class
Schema Class
constructor function : creates a Schema object after checking it doesn't exist yet
all associative array : stores all schemas according to their respective namespace
getType method : gets a type according to a given name for this schema
getType function : gets a type according to a given prefix:name
getTypeNS function : gets a type according to a given namespace and a given name
get function : gets a schema according to a given namespace
prefixes associative array : initializes default prefixes and namespaces
registerPrefix function : adds a prefix and the corresponding namespace to the "prefixes" associative array
"AtomicType" class
AtomicType Class
constructor function : initializes of patterns property
setBase method : copies the base patterns to this AtomicType object
put method : sets the base, copies patterns or just add a property
validate method : validates a value against this AtomicType object
normalize method : normalizes a value for fraction digits according to this AtomicType object
"ListType" class
ListType Class
constructor function : white space management as "collapse"
setItemType method : associates a Type object for each item in this ListType object
validate method : validates a value against this ListType object
canonicalValue method : computes the canonical value of a list value
"ListType" class
ListType Class
constructor function : initializes base types property
addType method : adds a Type object to this UnionType object
validate method : validates a value against at least one base type of this UnionType object
"TypeDefs" class
Default Type Definitions Initialization Class
initAll method : inits the default types definitions for XML Schema and XForms
init method : inits the default types definitions for a given namespace
Default associative array : every default type definition for XML Schema
base : prefix:name of the base type
whitespace : white space behavior
patterns : array of regular expressions
class : associated class
displayLength : number
fractionDigits : number
totalDigits : number
minInclusive : number
maxInclusive : number
minExclusive : number
maxExclusive : number
format : formatting function
parse : parsing function
Predefined types :
xsd:string
xsd:boolean
xsd:decimal
xsd:float
xsd:double
xsd:dateTime
xsd:date
xsd:time
xsd:duration
xsd:gDay
xsd:gMonth
xsd:gMonthDay
xsd:gYear
xsd:gYearMonth
xsd:integer
xsd:nonPositiveInteger
xsd:nonNegativeInteger
xsd:negativeInteger
xsd:positiveInteger
xsd:byte
xsd:short
xsd:int
xsd:long
xsd:unsignedByte
xsd:unsignedShort
xsd:unsignedInt
xsd:unsignedLong
xsd:normalizedString
xsd:token
xsd:language
xsd:anyURI
xsd:Name
xsd:NCName
xsd:QName
xsd:ID
xsd:IDREF
xsd:IDREFS
xsd:NMTOKEN
xsd:NMTOKENS
xsd:base64Binary
xsd:hexBinary
XForms associative array : every default type definition for XForms types
xforms:string
xforms:boolean
xforms:decimal
xforms:float
xforms:double
xforms:dateTime
xforms:date
xforms:time
xforms:duration
xforms:dayTimeDuration
xforms:yearMonthDuration
xforms:gDay
xforms:gMonth
xforms:gMonthDay
xforms:gYear
xforms:gYearMonth
xforms:integer
xforms:nonPositiveInteger
xforms:nonNegativeInteger
xforms:negativeInteger
xforms:positiveInteger
xforms:byte
xforms:short
xforms:int
xforms:long
xforms:unsignedByte
xforms:unsignedShort
xforms:unsignedInt
xforms:unsignedLong
xforms:normalizedString
xforms:token
xforms:language
xforms:anyURI
xforms:Name
xforms:NCName
xforms:QName
xforms:ID"
xforms:IDREF
xforms:IDREFS
xforms:NMTOKEN
xforms:NMTOKENS
xforms:base64Binary
xforms:hexBinary
xforms:email
xforms:card-number
xforms:url
xforms:amount
XSLTForms associative array : every default type definition for XSLTForms types
xsltforms:decimal
xsltforms:float
xsltforms:double
xsltforms:integer
xsltforms:nonPositiveInteger
xsltforms:nonNegativeInteger
xsltforms:negativeInteger
xsltforms:positiveInteger
xsltforms:byte
xsltforms:short
xsltforms:int
xsltforms:long
xsltforms:unsignedByte
xsltforms:unsignedShort
xsltforms:unsignedInt
xsltforms:unsignedLong
XForms Events Management
"Listener" class
Listener Class
constructor function : creates a Listener object to an observer element and attaches a standard callback function
attach method : attaches the event according to the current phase
detach method : detaches the event according to the current phase
clone method : creates a new listener for the given element
"XMLEvents" class
XForms Event Management Class
REGISTRY associative array : stores properties for each event
bubbles : boolean
cancelable : boolean
defaultAction : handler function with empty function as default
define function : convenient function to add a new event in the event registry
dispatchList function : dispatches the same event at every target in a given list
dispatch function : dispatches the given event at a given target with possibly different properties
default event management :
xforms-model-construct : fired at the end of the xforms.init() function before xforms-ready been fired
bubbles : yes
cancelable : no
default handler : construct() method
xforms-model-construct-done : fired at the end of the XFModel.construct() method after xforms-rebuild being fired
bubbles : yes
cancelable : no
default handler : empty
xforms-ready' : fired at the end of the xforms.init() function after xforms-model-construct been fired
bubbles : yes
cancelable : no
default handler : empty
xforms-model-destruct : fired in the xforms.close() function to every models
bubbles : yes
cancelable : no
default handler : empty
xforms-rebuild : fired in the xforms.closeChanges() function when a rebuild is required,
in the XFModel.construct() method before xforms-model-construct-done being fired and
in the XFSubmission.submit() method when the corresponding instance has just been replaced
bubbles : yes
cancelable : yes
default handler : rebuild() method
xforms-recalculate : fired in the xforms.closeChanges() function when a rebuild is not required,
at the end of the XFModel.rebuild() method and
in the XFControl.valueChanged() method when the new value is different
bubbles : yes
cancelable : yes
default handler : recalculate() method
xforms-revalidate : fired at the end of the XFModel.recalculate() method
bubbles : yes
cancelable : yes
default handler : revalidate() method
xforms-reset : fired by a listener generated by the XSL transformation for the xforms:reset element
bubbles : yes
cancelable : yes
default handler : reset() method
xforms-submit : fired by a listener generated by the XSL transformation for the xforms:submit element
bubbles : yes
cancelable : yes
default handler : submit() method
xforms-refresh : fired at the end of the XFModel.revalidate() method
bubbles : yes
cancelable : yes
default handler : refresh() method
xforms-focus : fired by a listener generated by the XSL transformation for the xforms:setfocus action
bubbles : yes
cancelable : yes
default handler : focus() method
DOMActivate : fired by the XFTrigger.click() method and by a listener generated by the XSL transformation for the xforms:submit element
bubbles : yes
cancelable : yes
default handler : empty
DOMFocusIn : fired by the XFControl.focus() method
bubbles : yes
cancelable : yes
default handler : empty
DOMFocusOut : fired by the xforms.blur() function to the element already having focus
bubbles : yes
cancelable : yes
default handler : empty
xforms-select : fired by the XFToggle.toggle(), XFSelect.normalChange() functions and XFSelect.itemClick() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-deselect : fired by the XFToggle.toggle(), XFSelect.normalChange() functions and XFSelect.itemClick() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-value-changed : fired by the XFControl.refresh() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-insert : fired by the XFInsert.run() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-delete : fired by the XFDelete.run() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-valid : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-invalid : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-enabled : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-disabled : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-optional : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-required : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-readonly : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-readwrite : fired by XFControl.refresh() method via the XFControl.changeProp() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-in-range : fired by the XFSelect.setValue() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-out-of-range : fired by the XFSelect.setValue() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-submit-done : fired by the XFSubmission.submit() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-submit-error : fired by the XFSubmission.submit() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-compute-exception : unused
bubbles : yes
cancelable : yes
default handler : empty
xforms-binding-exception : fired by the XFBind.refresh() method
bubbles : yes
cancelable : yes
default handler : empty
xforms-dialog-open : fired by a listener generated by the XSL transformation for the xforms:show action
bubbles : yes
cancelable : yes
default handler : show() method of the corresponding dialog
xforms-dialog-close : fired by a listener generated by the XSL transformation for the xforms:hide action
bubbles : yes
cancelable : yes
default handler : hide() method of the corresponding dialog
XPath Expressions Management
XPath expressions are "compiled" (converted to Javascript objects creation instructions) by the XSLT transformation. There is an "XPath" object for each distinct (according to its text source) expression. An implicit cast is usually performed for each parameter.
XPathAxis Class
XML Constants Class for axes as an associative array
NodeType Class
XML Constants Class for node types as an associative array
XNode Class
XNode Class
constructor function : initializes specific properties
getElementsByTagName method : gets an array of all elements with a given tag name for this XNode object
getTextContent method : gets the text context for this XNode object
appendChild method : appends a new child at this XNode object
replaceChild method : replaces a child of this XNode object
insertBefore method : inserts a child before another one of this XNode object
removeChild method : removes a child of this XNode object
setAttributeNS method : sets an attribute of this XNode object after creating it if necessary. "xsd:type" is interpreted to associate the corresponding type to this XNode object.
getAttributeNS method : gets the value of an attribute of this XNode object
removeAttributeNS method : removes an attribute of this XNode object
cloneNode method : clones this XNode object
init function : sets properties of this XNode object
recycle function : clears every properties of this XNode object and of its child XNode objects
create function : reuses a previously recycled XNode object or creates a new XNode object
XDocument Class
XDocument Class based on XNode Class
constructor function : creates a document XNode object
clear method : recycles every XNode objects composing this XDocument object
appendChild method : appends a node to this XDocument object
createElementNS method : creates an element XNode object for this XDocument object
createTextNode method : creates a text XNode object for this XDocument object
createAttributeNS method : creates an attribute XNode object for this XDocument object
getElementsByTagName method : gets an array of all elements with a given tag name for this XDocument object
transformToText method : applies a text XSL transformation to this XDocument object
unescape function : unescape entities within a serialized XML
parse function : parses a serialized XML to load it into this XDocument object
load function : gets a serialized XML at the given location to load it into this XDocument object
Writer Class
Writer Class
toString method : serializes an XNode object
XMLWriter Class
XMLWriter Class
toString method : serializes an XNode object
ArrayExpr Class
XPath Expression Class for array expressions
constructor function : initializes exprs property
evaluate method : evaluates as a node set this expression object
BinaryExpr Class
XPath Expression Class for binary expressions
constructor function : initializes specific properties
evaluate method : evaluates this Binary expression object. No precedence treatment required, this being already done at XSLT transformation step.
ExprContext Class
Context for XPath Expression evaluation Class
constructor function : initializes specific properties
clone method : creates a new expression context based on this Expression Context object
setNode method : set node and position properties for this Expression Context object
initDeps method : initializes dependency collections for this Expression Context object
addDepNode method : adds a node to the corresponding dependency collection for this Expression Context object
addDepElement method : adds an element to the corresponding dependency collection for this Expression Context object
TokenExpr Class
XPath Expression Class for token expressions
constructor function : initializes the value property
evaluate method : evaluates this Binary expression object value as a string value.
UnaryMinusExpr Class
XPath Expression Class for unary minus expressions
constructor function : initializes the expr property
evaluate method : evaluates this Unary Minus expression object.
CteExpr Class
XPath Expression Class for constant expressions
constructor function : initializes the value property
evaluate method : gets this Constant expression object value as is.
FilterExpr Class
XPath Expression Class for filtering nodes according to a predicate
constructor function : initializes specific properties
evaluate method : evaluates this filtering expression object
FunctionCallExpr Class
XPath Expression Class for core function calling
constructor function : checks a core function has the given name, initializes specific properties, pushes arguments
evaluate method : evaluates this function call expression object calling the corresponding Javascript function with the context and the same arguments
LocationExpr Class
XPath Expression Class for location expressions
constructor function : initializes absolute property and stacks successive steps
evaluate method : recursively evaluates the successive steps of this location expression object
NodeTestAny Class
XPath Expression Class for any node Expression ("*")
constructor function : initializes absolute property and stacks successive steps
evaluate method : always true
NodeTestName Class
XPath Expression Class for node test expressions
constructor function : initializes prefix and name properties
evaluate method : evaluates as a boolean value if a given node has the same namespace and name as this expression object. Wildcard is supported as a valid namespace test as an extension.
NodeTestPI Class
XPath Expression Class for processing instruction test expressions
constructor function : initializes target property
evaluate method : evaluates as a boolean value if a given node is a processing instruction with the same name as this expression object
NodeTestType Class
XPath Expression Class for node type test expressions
constructor function : initializes type property
evaluate method : evaluates as a boolean value if a given node has the same type as this expression object
NSResolver Class
XPath Expression Class for namespace resolving
constructor function : initializes map property as an empty associative array
registerAll method : registers all the namespaces from a given resolver in this Namespace Resolver object
register method : registers a prefix and an uri in this Namespace Resolver object
registerNotFound method : registers a prefix for a not found uri in this Namespace Resolver object
lookupNamespaceURI method : looks up for the corresponding uri for a given prefix in this Namespace Resolver object
PathExpr Class
XPath Expression Class for path expressions composed of a filter and a relative path
constructor function : initializes the filter and rel properties
evaluate method : first evaluates the filter then evaluates each combination with the relative path for this expression object
PredicateExpr Class
XPath Expression Class for predicate expressions
constructor function : initializes expr property
evaluate method : evaluates as a boolean value this predicate expression object comparing a number value to current position if possible
StepExpr Class
XPath Expression Class for location step expressions
constructor function : initializes axis, nondetest and unlimited number of predicates properties
evaluate method : evaluates as a node list this expression object according to the context
UnionExpr Class
XPath Expression Class for binary union expressions
constructor function : initializes expr1 and expr2 properties
evaluate method : evaluates as a node set this expression object
Miscellaneous Functions
stringValue function : string cast
booleanValue function : boolean cast
numberValue function : number cast
booleanValue function : number cast
xmlValue function : get the text value for the given node according to its type
xmlResolveEntities function : resolves every HTML entities in a given string into corresponding characters
stringSplit function : splits a string according to a character
XPath Class
XPath Class
constructor function : initializes properties and creates an associated namespace resolver. A compiled argument as string is interpreted as an error detected by the XSLT transformation.
evaluate method : evaluates the complete XPath expression et catches occurring exceptions
expressions associative array : stores every XPath object
get method : get an XPath object according to a given source text
new method : creates an XPath object if it doesn't already exists
registerNS method : register a namespace for all XPath expressions
XPathFunction Class
XPath Function Class
constructor function : initializes properties
acceptContext : whether the current context is required as first argument for this XPath Function object
defaultTo : default argument
DEFAULT_NONE : no default argument
DEFAULT_NODE : current node
DEFAULT_NODESET : array containing the current node
DEFAULT_STRING : text value of the current node
returnNodes : unused
body : corresponding Javascript function
call method : calls the corresponding Javascript function after managing default argument and context presence
XPathCoreFunctions Associative Array
Core XPath Functions
last()
position()
context()
count(nodeset)
id(node?)
local-name(nodeset?)
namespace-uri(nodeset?)
name(nodeset?)
string(nodeset?)
concat(string, string, string*)
starts-with(string, string)
contains(string, string)
substring-before(string, string)
substring-after(string, string)
substring(string, number) and substring(string?, number?, number?)
compare(string, string)
string-length(string?)
normalize-space(string?)
translate(string, string, string)
boolean(object)
not(boolean)
true()
false()
lang(string)
number(object)
sum(nodeset)
floor(number)
ceiling(number)
round(number)
power(number, number)
random()
boolean-from-string(string)
if(boolean, object, object)
choose(boolean, object, object)
avg(nodeset)
min(nodeset)
max(nodeset)
count-non-empty(nodeset)
index(string)
nodeindex(string)
property(string)
instance(string?)
now()
local-date()
local-dateTime()
days-from-date(string)
days-to-date(number)
seconds-from-dateTime(string)
seconds-to-dateTime(number)
current()
is-valid(nodeset?)
is-card-number(nodeset?)
digest(string, string, string?)
upper-case(nodeset?)
lower-case(nodeset?)
transform(nodeset?, string)
serialize(nodeset?)
Miscellaneous Functions
stringValue function : string cast
booleanValue function : boolean cast
numberValue function : number cast
booleanValue function : number cast
xmlValue function : get the text value for the given node according to its type
xmlResolveEntities function : resolves every HTML entities in a given string into corresponding characters
stringSplit function : splits a string according to a character