xsl-list
[Top] [All Lists]

RE: [xsl] Get position of parent

2009-01-17 14:31:57
Thank you.

Regards,

Phil


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Saturday, January 17, 2009 11:53 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Get position of parent

It rather depends what you mean by "position", but if you mean the number of
preceding siblings plus one, you can use

count(../preceding-sibling::*)+1

or if you prefer

<xsl:number select=".." count="*"/>

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Philip Vallone [mailto:philip(_dot_)vallone(_at_)verizon(_dot_)net]
Sent: 17 January 2009 13:42
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Get position of parent

Hello List,

What is the best way to get the position of a parent node? In the 
below xml, assume my context node is para:

/table/tgroup/tbody/row/entry[1]/para

If my context node is para, how do I get the position of its parent 
entry?

<table frame="all" align="center" id="C-TABLE3" width="90%">
      <title>Title</title>
      <tgroup cols="3">
              <colspec colnum="1" colname="spycolgen1" colwidth="*"/>
              <colspec colnum="2" colname="spycolgen2" colwidth="*"/>
              <colspec colnum="3" colname="spycolgen3" colwidth="*"/>
              <tbody>
                      <row>
                              <entry>
                                      <!--get position of
parent::entry-->
                                      <para id="table3-para 1">context
node</para>
                              </entry>
                              <entry>
                                      <para>test</para>
                              </entry>
                              <entry>
                                      <para>test</para>
                              </entry>
                      </row>
              </tbody>
      </tgroup>
</table>




Thanks
Phil



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>