[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: counting question
Hi Jo, > I am wanting to count all the child elements of a particular element > and treat them one way if there is only one child and another if > there are multiple. Is the best way to do this to test if the child > is both first and last or is there some other more sensible method? You can do it using the count() function: count(*) = 1 returns true if the context node has exactly one child element. Another method is to test whether there is a second child element: not(*[2]) returns true if there isn't a second child element (i.e. if there are 0 or 1 child elements). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|