XSLT extension elements and functions supporting the 4SS repository API Copyright 2004 Fourthought, Inc. (USA). Detailed license and copyright information: http://4suite.org/COPYRIGHT Project home, documentation, distributions: http://4suite.org/
The namespaces for extensions defined in this document are:
Prefix | Namespace |
---|---|
fcore | http://xmlns.4suite.org/4ss/score |
fhttp | http://xmlns.4suite.org/4ss/http |
fimap | http://xmlns.4suite.org/4ss/imap |
frdf | http://xmlns.4suite.org/4ss/rdf |
futil | http://xmlns.4suite.org/4ss/util |
The prefixes are given for this document only. Any other prefix can be used within a particular stylesheet.
Function | Syntax |
---|---|
fcore:as-dom | unknown fcore:as-dom(path) |
fcore:delete-session-data | unknown fcore:delete-session-data(key) |
fcore:get-absolute-path | unknown fcore:get-absolute-path(path) |
fcore:get-acl-by-key | unknown fcore:get-acl-by-key(aclKey, path) |
fcore:get-aliases | unknown fcore:get-aliases(path) |
fcore:get-all-acl | unknown fcore:get-all-acl(path) |
fcore:get-all-document-definition-paths | unknown fcore:get-all-document-definition-paths(path) |
fcore:get-available-handlers | unknown fcore:get-available-handlers(module) |
fcore:get-available-modules | unknown fcore:get-available-modules() |
fcore:get-base-definitions | unknown fcore:get-base-definitions(path) |
fcore:get-content | unknown fcore:get-content(path, encoding) |
fcore:get-creation-date | unknown fcore:get-creation-date(path) |
fcore:get-creation-params | unknown fcore:get-creation-params(path) |
fcore:get-current-user | unknown fcore:get-current-user() |
fcore:get-current-username | unknown fcore:get-current-username() |
fcore:get-derived-definitions | unknown fcore:get-derived-definitions(path) |
fcore:get-document-definition | unknown fcore:get-document-definition(path) |
fcore:get-groups | unknown fcore:get-groups(path) |
fcore:get-imt | unknown fcore:get-imt(path) |
fcore:get-last-modified-date | unknown fcore:get-last-modified-date(path) |
fcore:get-member-paths | unknown fcore:get-member-paths(group) |
fcore:get-metadata-resource | unknown fcore:get-metadata-resource(path) |
fcore:get-name | unknown fcore:get-name(path) |
fcore:get-ns-map | unknown fcore:get-ns-map(path) |
fcore:get-owner | unknown fcore:get-owner(path) |
fcore:get-parent | unknown fcore:get-parent(path) |
fcore:get-raw-content | unknown fcore:get-raw-content(path, encoding) |
fcore:get-rdf-maps | unknown fcore:get-rdf-maps(path) |
fcore:get-reference | unknown fcore:get-reference(path) |
fcore:get-size | unknown fcore:get-size(path) |
fcore:get-user-data | unknown fcore:get-user-data(key, path) |
fcore:get-user-data-keys | unknown fcore:get-user-data-keys(path) |
fcore:get-user-name | unknown fcore:get-user-name() |
fcore:get-user-or-group | unknown fcore:get-user-or-group(name) |
fcore:get-username | unknown fcore:get-username(path) |
fcore:has-resource | unknown fcore:has-resource(path) |
fcore:has-session | unknown fcore:has-session() |
fcore:hash-string | unknown fcore:hash-string(rawString) |
fcore:normalize-uri | unknown fcore:normalize-uri(uri, base) |
fcore:remove-user-data | unknown fcore:remove-user-data(key, path) |
fcore:repo-path-to-uri | unknown fcore:repo-path-to-uri(path) |
fcore:resource-type | unknown fcore:resource-type(path) |
fcore:session-data | unknown fcore:session-data(key) |
fcore:session-invalidate | unknown fcore:session-invalidate() |
fcore:set-user-data | unknown fcore:set-user-data(key, value, path) |
fcore:uri-to-repo-path | unknown fcore:uri-to-repo-path(uri) |
fcore:verify-acl | unknown fcore:verify-acl(aclKey, path, verifyTraverse) |
fhttp:get-query-args | unknown fhttp:get-query-args() |
fhttp:local-path | unknown fhttp:local-path(path) |
fhttp:local-uri | unknown fhttp:local-uri(uri) |
frdf:any | unknown frdf:any() |
frdf:complete | unknown frdf:complete(subj, pred, obj) |
frdf:contains | unknown frdf:contains(subj, pred, obj) |
frdf:versa-query | unknown frdf:versa-query(query, scope) |
Element | Syntax |
---|---|
fcore:add-acl | <fcore:add-acl
access = { string } ident = { string } allowed = { "yes" | "no" } path = { uri-reference } /> |
fcore:add-alias | <fcore:add-alias
alias = { uri-reference } doc-def = { uri-reference } path = { uri-reference } /> |
fcore:add-base-document-definition | <fcore:add-base-document-definition
docdef = { uri-reference } path = { uri-reference } /> |
fcore:add-member | <fcore:add-member
member-path = { uri-reference } path = { uri-reference } /> |
fcore:add-ns-map | <fcore:add-ns-map
prefix = { prefix } uri = { uri-reference } path = { uri-reference } /> |
fcore:add-rdf-map | <fcore:add-rdf-map
object = { string } object-is-resource = { "yes" | "no" } predicate = { string } subject = { string } path = { uri-reference } /> |
fcore:change-password | <fcore:change-password
path = { uri-reference } new-password = { string } /> |
fcore:create-container | <fcore:create-container
path = { uri-reference } base-path = { uri-reference } create-parents = { "yes" | "no" } /> |
fcore:create-document | <fcore:create-document
base-path = { uri-reference } cdata-section-elements = { qnames } docdef = { uri-reference } doctype-public = { string } doctype-system = { string } encoding = { string } imt = { string } indent = { "yes" | "no" } media-type = { string } method = { qname } omit-xml-declaration = { "yes" | "no" } path = { uri-reference } standalone = { "yes" | "no" } type = { string } version = { nmtoken } <!-- Content: template --> /> |
fcore:create-group | <fcore:create-group
path = { uri-reference } base-path = { uri-reference } /> |
fcore:create-raw-file | <fcore:create-raw-file
base-path = { uri-reference } cdata-section-elements = { qnames } content-as-string = "yes" | "no" doctype-public = { string } doctype-system = { string } encoding = { string } indent = { "yes" | "no" } media-type = { string } method = { qname } omit-xml-declaration = { "yes" | "no" } path = { uri-reference } standalone = { "yes" | "no" } version = { nmtoken } <!-- Content: template --> /> |
fcore:create-session | <fcore:create-session
key = { string } ttl = { number } /> |
fcore:create-uri-reference | <fcore:create-uri-reference
path = { uri-reference } base-path = { uri-reference } imt = { string } source-uri = { uri-reference } /> |
fcore:create-user | <fcore:create-user
password = { string } username = { string } base-path = { uri-reference } /> |
fcore:delete-resource | <fcore:delete-resource
path = { uri-reference } /> |
fcore:inherit-acl | <fcore:inherit-acl
access = { string } path = { uri-reference } /> |
fcore:login | <fcore:login
password = { string } user = { string } failure-redirect = { string } success-redirect = { string } timeout-redirect = { string } ttl = { number } /> |
fcore:mark-temporary | <fcore:mark-temporary
time-to-live = { number } path = { uri-reference } /> |
fcore:remove-acl | <fcore:remove-acl
access = { string } ident = { string } path = { uri-reference } /> |
fcore:remove-alias | <fcore:remove-alias
alias = { uri-reference } path = { uri-reference } /> |
fcore:remove-base-document-definition | <fcore:remove-base-document-definition
docdef = { uri-reference } path = { uri-reference } /> |
fcore:remove-member | <fcore:remove-member
member-path = { uri-reference } path = { uri-reference } /> |
fcore:remove-ns-map | <fcore:remove-ns-map
prefix = { prefixes } path = { uri-reference } /> |
fcore:remove-rdf-map | <fcore:remove-rdf-map
object = { string } predicate = { string } subject = { string } path = { uri-reference } /> |
fcore:repo-text-reindex | <fcore:repo-text-reindex />
|
fcore:repo-text-search | <fcore:repo-text-search
query = { string } /> |
fcore:rollback | <fcore:rollback />
|
fcore:session-data | <fcore:session-data
key = { string } value = { string } <!-- Content: template --> /> |
fcore:set-acl | <fcore:set-acl
access = { string } ident = { string } allowed = { "yes" | "no" } path = { uri-reference } /> |
fcore:set-content | <fcore:set-content
base-path = { uri-reference } cdata-section-elements = { qnames } content-as-string = "yes" | "no" doctype-public = { string } doctype-system = { string } encoding = { string } indent = { "yes" | "no" } literal-content = "yes" | "no" media-type = { string } method = { qname } omit-xml-declaration = { "yes" | "no" } path = { uri-reference } standalone = { "yes" | "no" } version = { nmtoken } <!-- Content: template --> /> |
fcore:set-creation-params | <fcore:set-creation-params
path = { uri-reference } <!-- Content: template --> /> |
fcore:set-document-definition | <fcore:set-document-definition
docdef = { string } path = { uri-reference } /> |
fcore:set-imt | <fcore:set-imt
imt = { string } path = { uri-reference } /> |
fcore:set-owner | <fcore:set-owner
owner = { uri-reference } path = { uri-reference } /> |
fcore:set-reference | <fcore:set-reference
reference = { uri-reference } path = { uri-reference } /> |
fcore:set-username | <fcore:set-username
new-name = { string } path = { uri-reference } /> |
fcore:x-update | <fcore:x-update
path = { uri-reference } <!-- Content: template --> /> |
fhttp:request-headers | <fhttp:request-headers />
|
fhttp:response-uri | <fhttp:response-uri
uri = { uri-reference } /> |
frdf:add | <frdf:add
o = expression p = expression s = expression scope = string-expression stmt-uri = string-expression type = expression /> |
frdf:complete | <frdf:complete
o = expression o-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } p = expression p-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } s = expression s-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } scope = string-expression scope-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } stmt-uri = string-expression stmt-uri-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } type = expression /> |
frdf:deserialize-and-add | <frdf:deserialize-and-add
path = { uri-reference } base-path = { uri-reference } <!-- Content: template --> /> |
frdf:deserialize-and-remove | <frdf:deserialize-and-remove
path = { uri-reference } base-path = { uri-reference } <!-- Content: template --> /> |
frdf:remove | <frdf:remove
o = expression o-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } p = expression p-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } s = expression s-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } scope = string-expression scope-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } stmt-uri = string-expression stmt-uri-flags = { "normal" | "regex" | "ignore-case" | "regex-ignore-case" } type = expression /> |
frdf:versa-assign | <frdf:versa-assign
name = { qname } query = { string } scope = { string } <!-- Content: template --> /> |
frdf:versa-query | <frdf:versa-query
query = { string } scope = { string } <!-- Content: template --> /> |
frdf:visualize | <frdf:visualize
graph-vis = { uri-reference } output-path = { uri-reference } map-name = { id } max-arcs = { number } namespaces = { string } resourcePath = { string } rotate = { "yes" | "no" } scoped = { "yes" | "no" } svg = { "yes" | "no" } uri-format = { string } <!-- Content: template --> /> |
futil:xml-rpc-invoke | <futil:xml-rpc-invoke
method = { string } uri = { uri-reference } p1 = expression p2 = expression p3 = expression p4 = expression p5 = expression t1 = expression t2 = expression t3 = expression t4 = expression t5 = expression /> |
Get an RTF that is as a live version of the document function. NOTE: This does not work like document(), where document() caches RTFs and always returns the same one per the spec, as-dom will return the latest in the repo.
Delete one of the key/value pairs stored in the session data
Get the full path into the system, resolving aliases if needed
Get a list of alias objects that reference this object
Get the resource (path) given a user or group name
Get the string content of this resource as an XPath string object path - the repository path to the object to retrieve encoding - the encoding to use in converting the content to Unicode
Get the date the resource was created
Get the resource (path) for the current user
Get the name (not the resource) of the current user
Get the date the resource was last modified
Returns, as a node-set of 'path' elements, the full paths to all user resources that are members of the specified group
Get the string meta data of this resource
Get the name of the resource.
Get the owner of the resource
Get the parent container of this resource
Get the string content of this resource as a raw Unicode object path - the repository path to the object to retrieve encoding - the encoding to use in converting the content to Unicode
Get the URI that this resource references
Gets property data associated with a user
Gets the names of properties associated with a user
Given a user name, return the user resource path
Get the user name given the path to a user resource. If the path is invalid or does not give a user object, '' is returned.
Query if the system has a resource specified by the path
See if this connection is in a session
Return a hash for a string DEPRECATED - use f:sha-hash()
Resolve a relative URI against a given base, in effect just turning it into a proper repository URI (ftss://...) if no base is given for a relative path
Erases property data associated with a user
Convert a full repository URI e.g. ("ftss:///spam/eggs") to a repository path (e.g. "/spam/eggs")
Get the resource type of the resource
Session data is stored under a session ID (a UUID string) and takes the form of zero or more key-value pairs. Each key is a unique string, and each value is either a string or a node-set. This XSLT extension function coerces the given key to its string-value and returns from the current session the node-set that is associated with that key. If the key does not exist in the current session, or if there is no current session, then an empty node-set is returned. There is no way to distinguish between an empty node-set as an indication of such an error and an empty node-set as the legitimate value for the given key.
Destroy the current session
Sets property data associated with a user
Convert a repository path (e.g. "/spam/eggs") to a proper repository URI e.g. ("ftss:///spam/eggs")
Verify that the testAclIdent is in the acl list specified by the acl key for this object.
fhttp:get-query-args() returns a node-set consisting of one 'requestParameters' element, containing one child element for each item in the HTTP request parameters, a.k.a. the query arguments (typically HTML form data). The HTTP server will have already decoded the parameters and made them available to the XSLT processor; this function merely provides access to that data as a node-set. The parameter name becomes the element name, and the value is the element's content. If there are multiple parameters with the same name, they'll manifest as separate elements.
Given a repo path, returns a repo path that is relative to the HTTP handler's document root, if possible. Otherwise, returns the given path unchanged.
Given an ftss URI, returns a URI reference. The reference will be relative to the HTTP handler's document root.
Runs a complete on the repository model, which matches patterns among the triples in the model. You provide whichever of the subject, predicate and object you'd like to match, and use the frdf:any() function as a wildcard. The return value is a generated node set which has one or more "Statement" elements, each with 5 children: "Subject", "Predicate", "Object", "StatementUri", "Scope" which represent the respective components of the RDF statement. for example: frdf:complete("http://spam.com", frdf:any(), frdf:any()) would return all statements with "http://spam.com" as the subjects.
Runs a conatins on the repository model, which matches patterns among the triples in the model. You provide whichever of the subject, predicate and object you'd like to match, and use the frdf:any() function as a wildcard. The return value is a boolean indicating whether or not a matching statement exists.
Perform a Versa Query as a function, return a node-set representing the outside list.
Add access for an given identifer and level to the ACL of a resource
Adds an alias for this resource to the repository.
Add a new document definition to a document definition's base defs.
Adds a user or group to the specified group
Change the namespace mapping of this doc def.
Change the rdf mapping of this doc def.
Changes the password of the specified user resource.
Creates a container, if createParents is true then all its parents along the path are created (if they dont exist). createParents defaults to false if not set. The base-path attribute is the base to use for the new containers path, if relative. If not specified it uses the path of the source document.
Creates a document with the given path, document definition and type. The output of the body of the element makes up the content of the resulting document. All the attributes available on the xsl:output instruction are also allowed on this element, in order to control the generation of the document. If the document type is not specified, and the internet media type of the source is XML, the type will be inferred from the content, if possible. If path is an empty string, then a UUID will be generated for the file name, which will be placed in the container that holds the source document of the transform. If the document definition specifies a full text index, then the content is indexed The content of the fcore:create-document element is a template; this is instantiated to create a sequence of nodes; a root node is created with this sequence of nodes as its children; the tree with this root node represents the subsidiary result document.
Creates a new group with the specified path. A group is a set of users and other groups.
Creates a raw file resource, using the specified path and internet media type. The output of the body of the element makes up the content of the resulting document. All the attributes available on the xsl:output instruction are also allowed on this element, in order to control the generation of the document. In order to set the IMT, use the media-type attribute The default is text/plain There is also a special value for the method attribute method="binary" is equivalent to method="text" and encoding="latin-1" (to simulate the binary byte stream)
Create a new repository session. This allows implicit log in on all requests, and the management of persistent state data.
Creates a new uri reference resource. A URI reference resource is a special object that references an external URI (which can be a file) and loads its contents whenever the resource is requested. It behaves in some ways similar to a soft link in UNIX.
Create a new user in the system
Delete this resource
Set the inheritance ACL of a resource
Log in a user and create a new repository session accordingly, establishing a session for the logged in user with implicit log in on all subsequent requests from that agent until timeout. Sessions also support the management of persistent state data. When the repo session eventually times out, the user is redirected to timeout-redirect on the next request.
Mark a resource as temporary
Remove the ACL from a resource
Remove an alias for this resource from the repository.
Remove a document definition from a document definition's base defs.
Removes a user or group from the specified group
Change the namespace mapping of this doc def.
Change the rdf mapping of this doc def.
Trigger a re-indexing for full-text in the repository (Requires SWISH-E as supporting software)
Invoke the full-text search to find text in the repository (Requires SWISH-E as supporting software)
Abort the current transaction (governing the current XSLT operation) which will undo all repository operations
Sets a key/value pair in the data for the current session data, for persistence in the user agent If the "value" attribute is used, the resulting string is the session entry value. If this attribute is omitted, a node set is the resulting value, whose sole entry is the root node of the result tree fragment from instantiating the template that makes up the content of this element.
Reset the ACL for a resource, and then optionally add access for an given identifer and level to the ACL of a resource
Set the string content of the resource with the given path, document definition and type. The output of the body of the element makes up the content of the resulting document, either literally or as a result of the contained XSLT instructions (according to the literal-content attribute). All the attributes available on the xsl:output instruction are also allowed on this element, in order to control the creation of the content. If the resource is a document whose definition specifies a full text index, then the content is re-indexed
Change the creation params of a document definition. The content of the fcore:set-creation-params element is a template for the new creation params in serialized format.
Change the Document Definition of a XML document
Change the IMT of a resource
Change the owner of a resource
Change what a URI reference references.
Set the username of a user resource.
Allows XML content to be updated with the XUpdate protocol The content of the fcore:xupdate element is a template for the XUpdate document source.
Adds statements to the repository model. The subject, predicates and objects can be strings or node sets node sets are converted to a list of strings by taking the string value of each item. String values are treated a list with one string. The cartesian product of statements that come from the list of subject, predicate and object strings are all added to the model using the given scope and statement URI.
Deserializes an RDF document into statements, and adds them to a scope The content of the frdf:deserialize-and-add element is a template for the RDF/XML source from which the statements are parsed.
Deserializes an RDF document into statements, and removes any statements in the given scope with matching triple values. The content of the frdf:deserialize-and-remove element is a template for the RDF/XML source from which the statements are parsed.
Removes statements to the repository model. The subject, predicates and objects can be strings or node sets node sets are converted to a list of strings by taking the string value of each item. String values are treated a list with one string. The cartesian product of statements that come from the list of subject, predicate and object strings and that match the given scope and statement URI are all removed from the model.
Execute a Versa query and assign the result to a Versa variable, for use in further queries. The variable becomes bound in the Versa context for the current stylesheet invokation, and thus will be defined on all Versa queries performed subsequently, through <frdf:versa-query> or <frdf:versa-assign>. The content of the frdf:versa-assign element is a template for the extra namespace mappings for the query (see /ftss/dashboard/NsMappings.xml for an example of the xml format). For example, if you have the following: <frdf:versa-assign query="type(rdfs:Class)" name="classes"/> You can later execute <frdf:versa-query query="$classes - rdfs:label -> *"/>
Execute a Versa query and put the results in serialized XML form to the XSLT processor output. The content of the frdf:versa-query element is a template for the extra namespace mappings for the query (see /ftss/dashboard/NsMappings.xml for an example of the xml format). The form of the Versa output is as documented in http://rdfinference.org/versa-xml.
This extension element uses GraphViz to generate a diagram of a given resource, a set of resources in a particular scope, or of the entire system model. It adds an HTML imagemap (a chunk of text that can be placed in a MAP element) to the result tree, and has the side effect of generating in the repository an SVG or JPEG image resource representing the corresponding diagram. output-path specifies the repo path of the diagram to generate. If the resource exists already, its content will be overwritten. If provided, resourcePath must to refer to either a specific resource in the system model or an RDF document in the repository. If it refers to an RDF document, then all RDF statements with that document's URI as their scope will be graphed. If the resourcePath refers to any other kind of resource, then only statements about it will be graphed. If no resourcePath is specified, then the entire system model will be graphed. The image map text placed in the result tree uses the uriFormat string to generate (by appying the uris of all resources against this string) the links for all resources in the image. imagemap information is generated and returned only if the uriFormat string is specified. Most RDF graphs are width heavy and the visualizer can be told to rotate the image 90 degrees which can be helpful far larger graphs (which could great widths). This is specified by the rotate attribute. If present, the graph is rotated, otherwise it isn't. The max-arcs attribute specifies the maximum number of arcs. If the graph requires more arcs, then nothing will be generated at all. This element can also take a versa query result as its child nodes. In this case, all the resources in the result are graphed and resource-path is ignored.
Invoke an XML-RPC server at a remote URI (Requires Python 2.2 or above) There are 5 attributes, p1, p2... which are used for the positional arguments to the remote method [this will be made less kludgy soon] Each one is an expression which follows the following conversion rules from the XPath data model: string -> string number -> floating-point number boolean -> boolean node set -> array of strings You can also coerce the value to a certain type by using an attribute of the form t1, t2,... corresponding to the pN attribute with one of the following string values: INT DOUBLE STRING BOOLEAN The return value is converted into an XML fragment representation, which is sent to output. string -> <String>[value]</String> floating-point number -> <Double>[value]</Double> boolean -> boolean <Boolean>["true" or "false"]</Boolean> array -> <Array>[sequence of child elements as above, according to array elements]</Array> An example of an array: <Array> <String>a string</String> <Float>123.4</Float> <Int>1234</Int> <String>another string</String> </Array> This means that in order to access a remote method obj.spam('eggs', 3) On a remote server at http://spam.com/xmlrpcserver And save the result of XSLT variable "monty", you can use the following XSLT snippet: <xsl:variable name="monty"> <futil:xml-rpc-invoke uri="http://spam.com/xmlrpcserver" method="obj.spam" p1="'eggs'" p2="3" t2="INT"/> </xsl:variable> No type coercion is used for p1 because XSLT string are generally unambiguous in converting to XML-RPC. However, the second param could be integer or double, so it is coerced (default is double). Beware that if an array is returned, you might need to use the exslt:node-set function to convert from result tree fragment to node set.