tmt.xml is a JavaScript library that offers sophisticated and somewhat unique functionalities for XML, XPath and XSLT. It works fine in FireFox 1.0+, IE 5.5+ ans Safari 3.1. Most of it doesn't works with Safari 1.x and 2.x, due to the limited XSLT and XPath support available in this old version.
While I did my best to make this a beginner friendly tool, in order to better leverage this library, familiarity with XML, XPath and XSLT and working knowledge of JavaScript are required.
In order to use this library you need tmt_xml.js, depending on the features you use you may need tmt_net.js too
| tmt.xml.evaluateXPath(domNode, pattern, namespaces) | Given a DOM node, evaluate an XPath expression against it.
Results are returned as an array of nodes. An empty array is returned in case there is no match Multiple namespaces must be separated by spaces like: tmt.xml.evaluateXPath(xmlDOM, xpathPattern, 'xmlns:blue="http://www.bluenote.com/" xmlns:fantasy="http://concordmusicgroup.com/"'); |
| tmt.xml.nodeToString(domNode) | Serialize a DOM node into a string |
| tmt.xml.stringToDOM(xmlStr) | Create a DOM document out of a string |
| tmt.xml.transformDOM(xmlInput, xsltInput, params, asString) | Given XSLT and XML (either strings or DOM documents), apply a transformation Third argument is optional, it's a set of name/value pairs inside a JavaScript object. Set it to {} if you don't need it but have to use the fourth argument Fourth argument is optional too, set it to true if you want to return a string instead of a DOM document See example |
| tmt.xml.transformStrings(xmlStr, xsltStr, params) | Given two strings, perform a trasformation Third argument is optional, it's a set of name/value pairs inside a JavaScript object |
| tmt.xml.transformUrl(xmlUrl, xsltUrl, callback, params, errback) | Transform the content of two url. Doesn't work in IE if protocol is file:/// Fourth argument is optional, it's a set of name/value pairs inside a JavaScript object Fifth argument is optional; it's a JavaScript function that will be invoked in case of errors Requires tmt_net.js Inside callbacks you can access (See example):
|
| tmt.xml.isSupported() | Returns true if the current browser is supprted by the library, false otherwise |