Submitted by alla on Thu, 11/25/2010 - 15:52

Adding XSLT Transforms | Table of Contents | Credits >

Probably the easiest way to make an XSLT transform is to start from an existing one and modify it. The XSLT transforms are located in XSLT directory (usually .magictree/xslt , see also Files and Directories).

An XSLT transform applied to an XML file should produce valid MagicTree XML. MagicTree si currently not very user-friendly when outputting XSLT parsing error messages, so we suggest first making sure that the XSLT file is syntactically correct and produces the desired output by using some other XSLT tool, such as xsltproc.

A sample of valid MagicTree XML can be obtained by unzipping a MagicTree project file and looking at content.xml

The XML syntax for various types of nodes is described in Node Types

For the semantic structure of the tree data (that is how the real world data is represented in the tree, wherre various pieces of information should go and how to represent them), see SemanticStructure

Most MagicTree XSLT transforms use the file service-map.xml to unify service names. Different tools often use different names for the same service. This file maps the service names to the values that should be used in the tree. Since services that are accessed over SSL are placed under <tunnel>ssl</tunnel> node, they are also listed in service-map.xml and have "ssl" attribute set to true. When writing an XSLT transform we recommend including this file and replacing the service names in the output.

When MagicTree loads an XML file after transforming it, the sibling nodes that are equal are always merged together. Sometimes that's not what you want. For example, multiple XSS findings are separate entities and really should not be merged together. To solve this problem we have introduced a special attribute "mergeID". It's value can be an arbitrary string. When two nodes are compared for equality for the purpose of merging, the presense of mergeID is checked. If both have mergeID and the two mergeIDs are different, the two nodes are considered not equal and are not merged together. In all other cases (no mergeID is present, or only one of the two nodes have mergeID) the two nodes are compared using the usual rules. If you are wrting an XSLT and you have nodes that are equal acording to MagicTree node comparison rules, while in fact they represent separate real world entities, add a unique mergeID attribute to each one of them, so that they don't get merged together. We do this in Burp XSLT using Burp's finding serial number for mergeID value.

Adding XSLT Transforms | Table of Contents | Credits >


+32 (0) 2 215 53 58

Gremwell BVBA
Sint-Katherinastraat 24
1742 Ternat
VAT: BE 0821.897.133.