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

Re: Re: Finding the maximum depth from a node

Subject: Re: Re: Finding the maximum depth from a node
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Fri, 10 May 2002 14:42:04 -0600
xslt finding depth
At 02:11 PM 5/10/2002, you wrote:
Here's a very simple solution -- use FXSL and its maximum()
function/template. Pass to it the list of "folder" nodes and a
reference to your comparison function, which will return 1 if the
"name" attribute of the first argument is bigger than the name
attribute of the second argument.

<xsl:if test="$arg1/@name > $arg2/@name">1</xsl:if>

This only compares the name attribute of the different nodes and returns that which has the highest value. The original question was to return the child node that had the largest hierarchy length. The OP might have confused the issue by making them the same node.


I was thinking something like the following, but it depends on knowing the length.
<xsl:value-of select="*//*[count(ancestor::*)>3]/@name"/>


Too bad there's not an extension function that works like the following invalid XSLT code:
<xsl:value-of select="*//*[max(count(ancestor::*))]/@name"/>


If I think of anything, I'll post it.


Greg Faron Integre Technical Publishing Co.



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.