This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: position()
- To: xsl-list at mulberrytech dot com
- Subject: Re: position()
- From: "G. Ken Holman" <gkholman at CraneSoftwrights dot com>
- Date: Sun, 16 Apr 2000 15:17:59 -0400
- Reply-To: xsl-list at mulberrytech dot com
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@CraneSoftwrights.com
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