[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Count Ancestors Up To But Not Including a Given Ty

Subject: RE: Count Ancestors Up To But Not Including a Given Type
From: "Bjorndahl, Brad" <brad.bjorndahl@xxxxxxxxxxxxxxxx>
Date: Tue, 5 Feb 2008 12:33:30 -0500
RE:  Count Ancestors Up To But Not Including a Given Ty

I'm transforming DITA too. Yes, it's quite wide open in some repects.

To keep track of how deeply nested I am, I initialize tunnel variables (such
as OLdepth and Uldepth) at the topic element, and increment them when I hit
elements such as ol ($OLdepth + 1) or ul ($ULdepth + 1).
When you are in the li element, include the param statements, remembering to
always specify tunnel="yes". Check the parent to see which value you want.
I think this is what tunnel variables are for.


-----Original Message-----
From: Eliot Kimber [mailto:ekimber@xxxxxxxxxxxx]
Sent: February 5, 2008 2:18 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Count Ancestors Up To But Not Including a Given Type

Maybe it's the lateness of the hour but I'm finding myself stymied on what I
hope is relatively simple check.

In DITA, as in many doctypes, you can have nested lists of the form:


As well as an intermixing of different list types, e.g.:


What I need to do is determine, for a given li, its depth of nesting within
unbroken ancestry of a given list type.

Thus, int the first example, the deepest li is a level 2 because it has two
ancestor <ol> elements with no intervening <ul> (or other non-list element
that might occur within <li> and itself contain a list). In the second
example, the deepest <li> is a level one because there is an intervening <ul>
between the two <ol> ancestors.

I can't for the life of me figure out either a single expression or a
recursive function that will return the correct answer.

What bit of logic am I failing to see? I am using XSLT 2.



Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.