This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

counting leaf nodes



Hi,

I need some help with an expression that will count the leaf
nodes on a given branch.  Let's say I have XML like

<su><!-- top level -->
        <su><!-- 2nd level -->
		<su><!-- 3rd level -->
			<su><!-- 4th level --></su>
			<su><!-- 4th level --></su>
			<su><!-- 4th level --></su>
		</su>
	</su>
        <su><!-- 2nd level -->
		<su><!-- 3rd level --></su>
		<su><!-- 3rd level --></su>
		<su><!-- 3rd level --></su>
	</su>
</su>

My goal is to be able to output this as an HTML table like

<TABLE BORDER=1>
<TR><TD COLSPAN=6>*</TD></TR> <!-- top level -->
<TR><TD COLSPAN=3>*</TD><TD COLSPAN=3>*</TR> <!-- 2nd level -->
<TR><TD COLSPAN=3>*</TD><TD>*</TD><TD>*</TD><TD>*</TD></TR> <!-- 3rd level -->
<TR><TD>*</TD><TD>*</TD><TD>*</TD></TR> <!-- 4th level -->
</TABLE>

As I process each su element, in order to calculate the COLSPAN
attribute, I need to know how many su elements there are below the
current one that don't have su children themselves.

Any help is appreciated.

--
perry


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]