This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Get parent's node position - Urgent


Ok Mike, thanks a lot. Excellent!!!
And what I would make to get a position of grand-parent??

Example:
XML (part)
---------------
<CURRICULO>
   <ATUACAO-PROFISSIONAL>
      <ATIVIDADES-DE-DIRECAO-E-ADMINISTRACAO>

<DIRECAO-E-ADMINISTRACAO>Atuacao1-Atividade1-Direcao1</DIRECAO-E-ADMINISTRAC
AO>

<DIRECAO-E-ADMINISTRACAO>Atuacao1-Atividade1-Direcao2</DIRECAO-E-ADMINISTRAC
AO>
      </ATIVIDADES-DE-DIRECAO-E-ADMINISTRACAO>
   </ATUACAO-PROFISSIONAL>
   <ATUACAO-PROFISSIONAL>
      <ATIVIDADES-DE-DIRECAO-E-ADMINISTRACAO>

<DIRECAO-E-ADMINISTRACAO>Atuacao2-Atividade1-Direcao1</DIRECAO-E-ADMINISTRAC
AO>
      </ATIVIDADES-DE-DIRECAO-E-ADMINISTRACAO>
   </ATUACAO-PROFISSIONAL>
</CURRICULO>

XSL (part)
--------------

<xsl:template match="DIRECAO-E-ADMINISTRACAO">
     <!-- I would like to get a position of <ATUACAO-PROFISSIONAL> element
that call this template -->
     <!-- Example:
     <xsl:value-of select="count(parent::*/preceding-sibling::*)"/>
     Get a position of <ATIVIDADES-DE-DIRECAO-E-ADMINISTRACAO> element. -->
</xsl:template>

-------------------------------------
Thanks a lot.

Paulo.


----- Original Message -----
From: Michael Kay
To: xsl-list@lists.mulberrytech.com
Sent: Wednesday, September 26, 2001 12:37 PM
Subject: RE: [xsl] Get parent's node position - Urgent


>
> To get the name of parent node I know:
> <xsl:value-of select="name(parent::*)"/>
> But I need the position.
>

What do you mean by "position"?
If you mean the number of preceding sibling elements, use

count(parent::*/preceding-sibling::*)

or use xsl:number

The position() function is about the position of the context node in the
sequence of nodes currently being processed, it has nothing to do with the
position of a node in the source tree.

Mike Kay


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]