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

Re: position()

Subject: Re: position()
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Apr 2000 15:17:59 -0400
position and re position products
At 00/04/16 08:17 +0100, you wrote:
I'm using position() function in two places.
...
Problem.

The 'number' I'm getting back is different in each case.
In the former case I get 1 to 7,

Because you are only selecting 'section' elements.


in the latter case I get 2 6 10 14 18 22 26

Can anyone suggest why they are different please?

Because you are probably selecting more than section elements.


Perhaps you are in <body> and you are asking that all child nodes be pushed through your stylesheet with <xsl:apply-templates/> (with no select= attribute) ... you are going to get *all* child nodes of <body> pushed, not just <section> nodes.

  <body>
   <title/>
   <section/>
   <section/>
   <note/>
   <section/>
  </body>

The sections above would be counted as 4, 6, and 10 due to the intervening element nodes and the intervening text nodes. It is often the text nodes that I forget about. I've illustrated this with a diagram on page 58 of the 7th edition.

The SHOWTREE stylesheet in the free resources section of our web site exposes a report of all nodes in the instance ... run your input through that stylesheet to see all of the intervening nodes.

I hope this helps.

............... Ken

--
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-04-7
Next instructor-led training:    2000-05-02,2000-05-11/12,2000-05-15,
-                                    2000-06-12,2000-06-13,2001-01-27


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.