Note: Reactivate this note every time. Annoying, but I am trying to make sur you only do what you really want to do...
Parameter | Example value |
---|---|
xmlTarget | item |
xmlValue | concat('Setting text to ',tb:property('Name')) |
set the text of each target node to the result of evaluating the given XPath for each target.
Parameter | Example value |
---|---|
xmlTarget | . |
xmlValue | item[1]/text/text() |
xmlStylesheet | item[2]/text/text() |
This command applies the given stylesheet (as xml text) to the given value (as xml or html text.)
You can obtain the XML text from a node, as here, or from a URL, using
tb:get-url('file:path-to-xml')
The xmlStylesheetParams are parsed from the following form:
paramName=xpath;paramName=xpath;...
and the values of the XPath are passed (as strings) to the stylesheet.
This command expects to obtain a (list of) items (and/or adornments) from the stylesheet and adds them to the targetNote.
Note that the result of applying the stylesheet does not need to be a rooted xml document, but can be a series of XML fragments.
If xmlUniqueItemSignature (a XPath) is given, a signature will be computed using that XPath for the newly created node, and the node will not be created if the target node already has a subnode with the same signature.
Parameter | Example value |
---|---|
xmlTarget | . |
xmlValue | tb:get-url('xmlrpc://www.oreillynet.com/meerkat/xml-rpc/server.php;meerkat.getCategories') |
xmlStylesheet | item[1]/text/text() |
This is the most advanced demonstration; it allows to call an arbitrary XML-RPC method. It uses the xmlrpc URI scheme described here:
http://mah.everybody.org/docs/xmlrpc-url-scheme-rfc
The results from the calling the XML-RPC procedure will be transformed by the specified XSLT stylesheet into Tinderbox nodes, which will then be inserted under the XML-RPC call definition.
Parameter | Example value |
---|---|
xmlTarget | item |
xmlName | 'example' |
Clears the named property of the target nodes
Parameter | Example value |
---|---|
xmlTarget | item |
Clears the text of the target nodes
Parameter | Example value |
---|---|
xmlTarget | item[tb:property('Name')='Target'] |
xmlValue | ../item[tb:prototype()='test'] |
Move a (list of) value notes to a target Note.
Note that, as prototypes are links and not really properties, they are not maintained
Parameter | Example value |
---|---|
xmlTarget | item[tb:property('Name')='Target'] |
xmlValue | ../item[string-length(tb:property('Name'))=2] |
Create aliases of each of the valueNotes under the targetNote.
This acts as a traditional Tinderbox agent.
If an alias to the same note already exists, it is not duplicated, but existing aliases are not cleared.
Parameter | Example value |
---|---|
xmlTarget | item |
xmlValue | tb:command-note()/item[substring-after(tb:property('Name',tb:target-note()),tb:property('Name'))!=''] |
xmlName | '-example' |
create new links from each of a list of target Notes to a set of value notes.
The value notes are given by XPath, recomputed relative to each target note.
The name of the link is optional. If prefixed by a "-", the link direction will be from value to target.
Here, we are using a name prefix to determine nodes
Parameter | Example value |
---|---|
xmlTarget | . |
xmlName | 'new note' |
Create a new note under each target note.
Parameter | Example value |
---|---|
xmlTarget | . |
xmlValue | 'http://www.example.com/' |
xmlName | 'href' |
create new links from each of a list of target Notes to a URL.
Parameter | Example value |
---|---|
xmlTarget | item[tb:property('Name')='Goner'] |
Removes the target nodes from the document
Parameter | Example value |
---|---|
xmlTarget | . |
Do the command(s) under this once, and deactivate self.
Parameter | Example value |
---|---|
xmlTarget | . |
The Eval command will simply evaluate a XPath and do nothing with it. It is mostly useful in combination with the tb:result-of XPath extension.
Parameter | Example value |
---|---|
xmlTarget | . |
def p(tbDoc,*a):
x = tbDoc.evalXPath("//item[tb:prototype() = 'XMLCommand']")
tbDoc.createAlias(tbDoc.commandNote, x)
return x
Parameter | Example value |
---|---|
xmlTarget | .//item[attribute[@name='Alias']] |
This is the most powerful command: It will execute all commands under it once for each target.
It can also act as a conditional, if the target XPath evaluates as an empty list.
At each step, the result of this note is set to be the current target note, which you can retrieve using
tb:result-of(some expression that returns the ForEach command note)
Parameter | Example value |
---|---|
xmlTarget | item[tb:property('Name')='Target'] |
xmlValue | ../item[tb:prototype()='test'] |
Move a (list of) value notes to a target Note.
Parameter | Example value |
---|---|
xmlTarget | item |
xmlValue | string-length(tb:property('Name')) |
xmlName | 'example' |
Set the property 'xmlName' to the value given by applying the 'xmlValue' XPath on each of the (list of) target notes.
The value is considered to be a XPath, computed at each target note.
Note: You have to make sure the attribute name is declared as a user attribute for this document; this does not (yet) ensure user attribute declarations.
Parameter | Example value |
---|---|
xmlTarget | item |
xmlName | 'test' |
Set each target node's prototype to the given prototype. Give either the prototype's node (from the value XPath) or name.
Parameter | Example value |
---|---|
xmlTarget | item |
xmlValue | concat('Setting text to ',tb:property('Name')) |
set the text of each target node to the result of evaluating the given XPath for each target.
Last modified on 03/02/06. Created by Marc-Antoine Parent with Tinderbox 3.0.4.