Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2011, 07:55 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default max number of elements - how to?

Hi All,

Code:
<root>
<ITEMDETAILS>
<LOTDETAILS></LOTDETAILS>
<LOTDETAILS></LOTDETAILS>
</ITEMDETAILS>

<ITEMDETAILS>
<LOTDETAILS></LOTDETAILS>
</ITEMDETAILS>
</root>
I need to find the maximum number of LOTDETAILS elements per one ITEMDETAILS element. In this case the answer would be 2. I can only use xpath 2.0

Thanks.
 
Old January 12th, 2011, 08:07 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Try
Code:
max(/root/ITEMDETAILS/count(LOTDETAILS))
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
JohnBampton (January 12th, 2011)
 
Old January 12th, 2011, 09:11 AM
Friend of Wrox
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default

Great work, thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation For Phone Number and Mobile Number dhruthi.ram99 Javascript How-To 12 October 30th, 2011 07:24 AM
How to check whether an elements contains another elements or not? metinhoclam XSLT 5 August 14th, 2010 10:11 AM
How to add a line number/Row number- need to use it for page breaks naijacoder XSLT 7 September 27th, 2009 09:42 PM
Chap 16 pg 574: Elements not supported Elements not known tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 August 6th, 2009 02:48 PM
finding max string length if more than 2 elements srini XSLT 4 April 4th, 2006 01:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.