Older tools

This is the first version of my Tinderbox tools, using straight XSLT for implementing commands.

My extensions can be used through the tbxsl.py file. Currently, it takes two arguments: A XSLT file and a Tinderbox file. The result is printed to stdout, or to a file named using a -o optional parameter (before the arguments). It currently provides the following XPath extensions and XSLT elements in the xmlns:tb="http://eastgate.com/Tinderbox/maparent" and xmlns:rpc="http://maparent.webhop.net/xmlrpc" namespaces. (I intend to change those namespaces and remove my userId after the API stabilizes, which would be after some user feedback.)

Returns the name of the prototype of the item

will also provide the default if the property is absent

Will provide a new valid ID for items generated in XSLT

returns a nodeset of linked items. Direction forwards by default, linktype optional

assume the eval starts with a python def. The function will be passed the XSLT context for the current item node, and any optional arguments provided in the use of eval in the XSLT, and should return a nodeset.

evaluate a XPath and returns a nodeset. Equivalent to dyn:evaluate

This declares a new link between two nodes, which will be created later. For each node, you can either provide the node itself, or its Id. Node creators are deduced unless provided. (for new nodes, we have to assume creator is 'system'.) If you give a URL, the destId is optional.

If the start is not given, but startId is given, assume current text position in the output text. Must then be matched by a tb:endNewLink.

Signals the end of a text-based hyperlink. The slen will be set accordingly. The id must match the startId of a previous invocation of tb:declareNewLink

This inserts nodes for the links declared through declareNewLinks. Should be called within the links tag.

Declare a style change at the current text position in a text run. There must be a tb:declareStyleChange provided at the beginning of the text run. Each element optional; can be called many times at a given text position and the specidied text attributes will combine.

Inserts (at the current position) the <style> tag with tstyles provided by the previous <tb:declareStyleChange> tags.

This one involves somewhat tricky code. (Read: It may break with newer versions of libxml.) It emulates the presence of some markup within a tinderbox note's text, so that paragraphs are enclosed within a <p>..</p> element (optional) and (optionally some) text-bound links are enclosed within a <link ref="#itemID" name="linkType">..</link>, to ease further XSLT processing (through a apply-templates on the result of calling that function). (I did not extend this to text styles, but intend to so in the near future.)

This allows to call an arbitrary XML-RPC method, by name and URL. The parameters must be supplied as a nodeset, and the signature as another nodeset of strings describing the types (currently, only 'string' and 'int' are supported.)

Calls a stylesheet, designated by filename (for now) on a XML node, which can come from a call to the previous function...

Within a stylesheet invoked by callStylesheet, this allows access to the calling node from the calling document. Needs heavy testing, as you are juggling two XSLT contexts. May crash horribly, but has not so far. Not reentrant or multithreaded at this time.

Further, tbxsl implements a key on the item's ID, as if the following line were in your XSLT:

Here is an example usage of such a system:

The transformation.xsl XSLT file will evaluate any XPath it finds in the Tinderbox attribute xpath_alias_attribute, or execute a python function whose code is in the text of an item which has a prototype named Programme, and create Tinderbox aliases of items found in the resulting nodeset. The aliases will be inserted under the item where the XPath or Python function was found, which makes these nodes work as a kind of agent. You can try out this functionality, and a few others, on the sample file (example.tbx). It also needs a few other files to be in the same directory:

This work is licensed under a Creative Commons License (Share Alike).

  • tbxsl.py
  • transformation.xsl
  • meerkatTransform.xsl
  • htmlToText.xsl
  • somehtml.xhtml
  • Last modified on 28/05/04. Created by Marc-Antoine Parent with Tinderbox 3.0.4.