Re: outputting the "position()" of parent

Subject: Re: outputting the "position()" of parent
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Wed, 07 Jun 2000 23:02:47 +0100

Justin Friedl wrote:
> How do I output the posistion of the parent.  I can output the position of
> the current node like this:
> <xsl:value-of select="position()"/>
> So I thought I could do this:
> <xsl:value-of select="../position()"/>
> but it doesn't work.... any suggestions?

David Carlisle (whom I trust is home by now!) came up with the solution
to this:

<?xml version="1.0"?>

<?xml version="1.0"?>
  xmlns:xsl=""; version="1.0">
  <xsl:template match="b">
      <xsl:text>b's parent is in position </xsl:text>
      <xsl:value-of select="count(../preceding-sibling::*)+1" />

result (saxon):
<?xml version="1.0" encoding="utf-8" ?><result>b&#39;s parent is in
position 5</result>


 XSL-List info and archive:

Current Thread