[Fwd: [GCC-XML] XSLT: getting the "object tree" from GCC-XML output]

Doug Gregor dgregor at cs.indiana.edu
Wed Jul 28 22:08:24 EDT 2004


i. Having to tokenize the members of each class and trying to get the
> arrays of objects like required (see the XSLT file) seems to require
> lots of recursion depth. xsltproc choked on it ["xsltApplyOneTemplate:
> loop found?? try increasing xsltMaxDepth (--maxdepth)" after 45mins,
> didn't try this yet], but with msxml4 it takes about 2 minutes to
> process. I'm considering using some kind of an XSLT extension, but I've
> no experience using those.

In my experience, template depth is rarely (if ever) a problem with 
XSLT; I've processed much larger XML files through more phases without 
any problems. In this case, it's the use of XPath expression such as 
"//*[@id=$string]" that kill performance, because they essentially 
require one to process the entire document each time to find matching 
elements. Instead, you should be using <xsl:key> elements and the "key" 
XPath function. I've attached an optimized version of your stylesheet, 
which xsltproc handles in 0.3 seconds on my G4 Mac (with the same 
output, but see below).

> ii. however, looping through the array elements doesn't work with msxml
> either: it seems to <xsl:apply-templates> only for the first round of
> the loop.

This is just a simple omission; when calling "countdown" recursively 
you need to pass something for the "type" parameter; I've made this 
addition on line 160 of the attached stylesheet; remove this line to 
get the exact same output that you were getting with msxml with the 
stylesheet you sent.

	Doug

*****************************************************************************
**                                                                         **
** WARNING:  This email contains an attachment of a very suspicious type.  **
** You are urged NOT to open this attachment unless you are absolutely     **
** sure it is legitmate.  Opening this attachment may cause irreparable    **
** damage to your computer and your files.  If you have any questions      **
** about the validity of this message, PLEASE SEEK HELP BEFORE OPENING IT. **
**                                                                         **
** This warning was added by the IU Computer Science Dept. mail scanner.   **
*****************************************************************************

-------------- next part --------------
A non-text attachment was scrubbed...
Name: object_tree_optimized.xsl
Type: application/octet-stream
Size: 8221 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/gccxml/attachments/20040728/b7fe365c/attachment.obj>


More information about the gccxml mailing list