Finding depth in output tree?

Here should go questions about transforming XML with XSLT and FOP.
alyxandr
Posts: 18
Joined: Sat Aug 01, 2009 7:52 pm

Finding depth in output tree?

Post by alyxandr »

Hi all,

count(ancestor-or-self::*) yields your current depth in the input tree -- is there anything similar that will tell you at what level in the output tree the current template is generating tags? Or would this require some sort of precognition in the XSLT processor?

(I'm asking on behalf of an imported template, which doesn't necessarily know much about the transform that imported it.)

Thanks, --alex.
adrian
Posts: 2850
Joined: Tue May 17, 2005 4:01 pm

Re: Finding depth in output tree?

Post by adrian »

Hi,

Unfortunately there isn't a function or axis that tells you the depth of the output. One possible solution would be to keep the output in a variable instead of actually outputting it, and then analyze the contents of that variable. But this is not useful in your situation since you have an unaware template.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
alyxandr
Posts: 18
Joined: Sat Aug 01, 2009 7:52 pm

Re: Finding depth in output tree?

Post by alyxandr »

Thanks! I've ended up being able to pass a parameter, which gets one added to it when calling apply-templates, but it's comforting to know that i wasn't missing something obvious. --alex.
Post Reply