Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] Absolute position

Expand Messages
  • John E. Simpson
    Use a template rule like the following:
    Message 1 of 2 , Mar 15, 2001
    • 0 Attachment
      Use a template rule like the following:

      <xsl:template match="parent">
      <html>
      <head><title></title></head>
      <body>
      <table>
      <xsl:for-each select="descendant::*">
      <tr>
      <td><xsl:value-of select="name()"/></td>
      <td><xsl:value-of select="position()"/></td>
      </tr>
      </xsl:for-each>
      </table>
      </body>
      </html>
      </xsl:template>

      The key is to use the descendant axis. If you want to count the parent
      element as well, make it descendant-or-self; and if you want to count nodes
      of all types, not just elements, replace the asterisk in the select
      attribute with node(), e.g. select="descendant::node()"

      At 04:23 AM 03/15/2001 -0500, Carmelo Montanez wrote:
      >Hi all:
      >
      > Does anyone knows how to get the aboslute value of an element
      >within a tree? and by that I mean the order on which it is listed
      >within that tree. Look at the tree below
      >
      > <child1>
      > </child1>
      > <child2>
      > <child2-1>
      > <child2-1-1>
      > <child2-1-1-1>
      > </child2-1-1-1>
      > </child2-1-1>
      > </child2-1>
      > </child2>
      > <child3>
      > <child3-1>
      > </child3-1>
      > </child3>
      > <child4>
      > </child4>
      ></parent>
      >
      >To be more clear I am looking for this type of information
      >
      >"child1" - is number 1
      >"child2" - is number 2
      >"child2-1" - is number 3
      >"child2-1-1" is number 4
      >"child2-1-1-1" is number 5
      >"child3" is number 6
      >"child3-1" is number 7
      >"child4" is number 8
      >
      >and so on ....

      ================================================================
      John E. Simpson | "I had a friend who was a clown. When
      http://www.flixml.org | he died, all his friends went to the
      XML Q&A: www.xml.com | funeral in one car." --Steven Wright
    Your message has been successfully submitted and would be delivered to recipients shortly.