[xsl] Position() with absolute paths

Subject: [xsl] Position() with absolute paths
From: "Jeff Cann" <Jeff.Cann@xxxxxxxxxxxxxxx>
Date: Thu, 5 Aug 2004 15:21:23 +0100
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please read the disclaimer at the bottom of this e-mail.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Hi,

I was wondering how to find the number of elements with a certain path that
precede the current element. For example, I have the document:

<a>
  <b>
    <c>
      <e attr="345" />
      <d attr="xyz">
        <e x="1"/>
        <e x="2"/>
        <e x="3"/>
      </d>
      <d attr="xyz">
        <e x="4"/>
        <e x="5"/>
        <e x="6"/>
      </d>
    </c>
    <c>
      <e attr="123" />
      <d attr="abc">
        <e x="7"/>
        <e x="8"/>
        <e x="9"/>
      </d>
      <d attr="xyz">
        <e x="10"/>
        <e x="11"/>
        <e x="12"/>
      </d>
    </c>
  </b>
</a>

Say the current node is /a/b/c/d/e (where @x="8"), how do I find the number of
/a/b/c/d/e elements (not just the number of 'e' elements) that precede the
current node? The reason I need to use the full path is because this is for a
generic paging stylesheet, where the full path is passed in as an arguement.
I have been trying to use count(preceding:://a/b/c/d/e), but this is invalid.
Any help greatly appreciated!

Thanks,
Jeff.



**********************************************************************
This email is intended for the named recipient(s) only. Its contents
are  confidential and may only be retained by the named recipient(s)
and may only be copied or  disclosed  with the consent of
LCH.Clearnet Limited.   If you are not an intended recipient please
delete this e-mail and notify postmaster@xxxxxxxxxxxxxxxx

The contents  of this  email are  subject to  contract in all cases,
and LCH.Clearnet Limited makes no contractual commitment save where
confirmed by hard copy.  LCH.Clearnet Limited accepts no liability,
including liability for negligence, in respect of any statement in
this email.

LCH.Clearnet Limited, Registered Office: Aldgate House,
33 Aldgate High Street, London EC3N 1EA.    Recognised as a Clearing
House under the Financial Services & Markets Act 2000. Reg in England No.25932
Telephone: +44 20 7426 7000              Internet: http://www.lchclearnet.com
**********************************************************************

Current Thread