|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Recursive Template Application
> This stylesheet works only half-way in that it correctly > transforms "<toc/>" to "<section .../>" but leaves it at that. The output of T1 > is not matched by T2. But how can I enforce this, so that "<toc/>" is > finally transformed to "<h2>..."? Should I run the XSL processor twice? Or is there a more > efficient way to accomplish this? > XSLT is a "single-pass" process, all template rules are applied to the input document (or tree), there's no standard way within the language of applying a second transformation to the result of the first. There are two ways round this: 1: the node-set() extension (available in xt, saxon, and in a different form in MSXML3). This allows you to convert a result-tree-fragment to a node-set. So you first template rule can generate an r-t-f, you can then convert this to a node-set, and apply further templates to that nodeset. 2: perform several transformations in series, using different stylesheets. You can control this from the API of your chosen XSLT processor, or in the case of Saxon, you can control it from within the stylesheet by writing e.g. <saxon:output next-in-chain="phase2.xsl"> Mike Kay XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








