Several extension functions are available when using the XSLT processor integrated in the pure::variants XML Transformation System for model transformations and model exports. These extension functions are defined in own namespaces. Before they can be used in an XSLT script, the corresponding namespaces have to be included using the "xmlns" stylesheet attribute:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pv="http://www.pure-systems.com/purevariants" extension-element-prefixes="pv"> ...any script content... </xsl:stylesheet>
After including the namespace, the extension functions can be used
in XPath expressions
using the defined namespace prefix, e.g.
F
.
The following extension functions are defined in the namespace "http://www.pure-systems.com/purevariants" and provide access to the pure::variants model information.
Table 9.10. Extension functions providing model information
Function | Description |
---|---|
Get all input models known to the transformer, i.e. the opened variant description model, and all Feature and Family Models of the Configuration Space without any modifications. See Section 5.9.2, “ Variant Result Models ” for more information about the transformation input. Note: In the pure::variants Server Edition this function returns an empty set. Access to the input models of the transformation is not supported in the pure::variants Server Edition. | |
Get all variant Result Models known to the transformer having the given id. The Result Models are derived from the models of the Configuration Space describing a single concrete solution drawn from the solution family. See Section 5.9.2, “ Variant Result Models ” for more information about the transformation input. | |
Get all Variant Result Models known to the transformer having the given name. The Variant Result Models are derived from the models of the Configuration Space describing a single concrete solution drawn from the solution family. See Section 5.9.2, “ Variant Result Models ” for more information about the transformation input. | |
Get all Variant Result Models known to the transformer having the given type. The Variant Result Models are derived from the models of the Configuration Space describing a single concrete solution drawn from the solution family. Valid types are ps:vdm , ps:cfm , and ps:ccm . See Section 5.9.2, “ Variant Result Models ” for more information about the transformation input. | |
boolean hasFeature(string)
| Return true if the feature, given by its unique name or id, is in the variant. |
boolean
hasComponent(string)
| Return true if the component, given by its unique name or id, is in the variant. |
boolean
hasPart(string)
| Return true if the part, given by its unique name or id, is in the variant. |
boolean
hasSource(string)
| Return true if the source, given by its unique name or id, is in the variant. |
boolean hasElement(string
id)
| Return true if the element, given by its unique id, is in the variant. |
boolean hasElement(string
name,string class,string type?)
| Return true if the element, given by its unique name, class, and (optionally) type, is in the variant. |
nodeset getElement(string
id)
| Return the element given by its unique id. |
nodeset getElement(string
name,string class,string type?)
| Return the element given by its unique name, class, and (optionally) type. |
nodeset
getChildrenTargets(string id)
| Return the full qualified ids of the children elements of the element with the given id. |
nodeset
getChildrenTargets(nodeset element)
| Return the full qualified ids of the children elements of the given element. |
nodeset
getChildrenTargets(string ename,string eclass,string etype?)
| Return the full qualified ids of the children elements of the element given by its unique name, class, and (optionally) type. |
boolean
hasAttribute(string id)
| Return true if the attribute, given by its unique id, is in the variant. |
boolean
hasAttribute(nodeset element,string name)
| Return true if the attribute, given by its name and the element it belongs to, is in the variant. |
boolean
hasAttribute(string eid,string name)
| Return true if the attribute, given by its name and the id of the element it belongs, to is in the variant. |
boolean
hasAttribute(string ename,string eclass,string etype?,string
name)
| Return true if the attribute, given by its name and the unique name, class, and (optionally) type of the element it belongs to, is in the variant. |
nodeset
getAttribute(string id)
| Return the attribute given by its unique id. |
nodeset
getAttribute(nodeset element,string name)
| Return the attribute given by its name and the element it belongs to. |
nodeset
getAttribute(string eid,string name)
| Return the attribute given by its name and the id of the element it belongs to. |
nodeset
getAttribute(string ename,string eclass,string etype?,string
name)
| Return the attribute given by its name and the unique name, class, and (optionally) type of the element it belongs to. |
boolean
hasAttributeValue(nodeset attribute)
| Return true if the given attribute has a value. |
boolean
hasAttributeValue(string id)
| Return true if the attribute given by its unique id has a value. |
boolean
hasAttributeValue(nodeset element,string name)
| Return true if the attribute, given by its name and the element it belongs to, has a value. |
boolean
hasAttributeValue(string eid,string name)
| Return true if the attribute, given by its name and the id of the element it belongs to, has a value. |
boolean
hasAttributeValue(string ename,string eclass,string etype?,string
name)
| Return true if the attribute, given by its name and the unique name, class, and (optionally) type of the element it belongs to, has a value. |
nodeset
getAttributeValue(nodeset attribute)
| Return the values of the given attribute. |
nodeset
getAttributeValue(string id)
| Return the values of the attribute given by its unique id. |
nodeset
getAttributeValue(nodeset element,string name)
| Return the values of the attribute given by its name and the element it belongs to. |
nodeset
getAttributeValue(string eid,string name)
| Return the values of the attribute given by its name and the id of the element it belongs to. |
nodeset
getAttributeValue(string ename,string eclass,string etype?,string
name)
| Return the values of the attribute given by its name and the unique name, class, and (optionally) type of the element it belongs to. |
The following extension functions are defined in the namespace "http://www.pure-systems.com/xmlts" and provide basic information about the current transformation.
Table 9.11. Extension functions providing transformation information
Table 9.12. Extension elements for logging and user messages
The following extension functions are defined in the namespace "http://www.pure-systems.com/path" and provide additional file operations.
Table 9.13. Extension functions providing file operations
The following extension functions are defined in the namespace "http://www.pure-systems.com/string" and provide additional string operations.
Table 9.14. Extension functions providing string operations
Function | Description |
---|---|
nodeset parse(string
xml)
| Parse the given string as XML and return the resulting node set. |
boolean matches(string
str,string pattern)
| Match the regular expression pattern against the given string. Return true if the pattern matches. |
nodeset match(string
str,string pattern)
| Match the regular expression pattern against the given string and return the set of sub-matches. |
string submatch(string
str,string pattern,number n)
| Match the regular expression pattern against the given string and return the n-th sub-match. |
string replace(string
str,string pattern,string replacement,number n?)
| Replace the matches in the given string with the replacement string using the regular expression match pattern. The optional fourth parameter specifies the maximal number of replacements. 0 means all, 1 means to replace only the first, 2 means to replace the first 2 matches etc. Returns the resulting string. |
string expand(string
str)
|
Expand variables in the given string and return
the expanded string. Variables are recognized by the following
pattern:
$(VARIABLENAME)
. See
Section 9.9, “
Predefined Variables
”
for the list of supported variables.
|
Further information about XSLT extension functions is available in the external document XML Transformation System .