Hi,
what you say is right, but it doesn't answer my question:
when I use
<xsl:template match="//section/para"> ...
it is the same:
<xsl:if test="position()= 3" > will have no result
and <xsl:if test="position()= 1" > has 2 results
when I use
<xsl:template match="//para">
<xsl:if test="position()= 1" >
I get 2 results
when I use
<xsl:template match="//para">
<xsl:if test="position()= 3" >
I get 0 results.
So the logic is always the same:
The context is made up by the para-Element with the same
parent-section-Element.
I seems not to be possible to create a context that consists only of
all para-Elements without respect of the parent-section-element, and this
is, what I'm looking for.
Matthias
"Yuriy Solodkyy" <sw@softasap.com> schrieb im Newsbeitrag
news:Oo**************@TK2MSFTNGP10.phx.gbl...
Hi,
See the "position Function" reference in "Microsoft XML Core Services
(MSXML) 4.0 - XPath Reference". The position() function is sensetive to
the calling context. For exaple, if you apply-templates to select "//para"
you will have different result, or even if select is section/para than if you
apply templates separately for each section or default templates are used.
The sample SDK describes this in details.
Yuriy
"Matthias Lohrer" <ma*************@mlohrer.de> wrote in message
news:3f*********************@read.news.de.uu.net.. . Hi,
my XML-Document hat this structure
<book>
<section>
<para />
<para />
</section>
<section>
<para />
<para />
</section>
</book>...
Now I need to find the third para-element of all para-Elements.
In my XSLT-Stylesheet I write
<xsl:template match="para">
<xsl:if test="position()= 3" >
do something
</xsl:if>
</xsl:template>
This does not work. He finds nothing. When I test
position()=1
he finds the first para of the first section and the first para of the
second section
Is there any possibility to find out the position of the current
para-node comparing to _all_ para-elements within the whole document?
Thanks
Matthias
ml@mlohrer.de