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

RE: Getting the deepest node and calculating relative

Subject: RE: Getting the deepest node and calculating relative paths
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Thu, 25 Jan 2001 10:19:32 -0000
xpath deepest node
> I need to transform an XML that looks like:
> 
> <Root>
> 	<Paths>
> 		<Path value="/Catalog/Department/Product/SKU"/>
> 		<Path value="/Catalog/Department/@dept_id"/>
> 		<Path value="/Catalog/Department/Product/Name"/>
> 		<Path value="/Catalog/Department/Product/Price"/>
> 		<Path value="/Catalog/Department/Product/Variant/Name"/>
> 	</Paths>
> </Root>
> 
> to something that looks like:
> 
> <Root>
> 	
> <LongestPath>/Catalog/Department/Product/Variant/Name</LongestPath>

Would counting the number of "/" characters give you the right answer?
You can do that as

string-length($path) - string-length(translate($path, '/', ''))

Mike Kay 

 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.