Help interpreting XSL count keyword

Discussion in 'XML' started by laredotornado@zipmail.com, Jan 13, 2005.

  1. Guest

    Hello, I am trying to decipher an XSL sheet that is not my own, and
    yes, I'm a newbie.

    <xsl:template match="sentence">
    <xsl:variable name="lines" select="count(line) +
    count(preceding::line)"/>
    <xsl:copy>
    <xsl:attribute name="sectionnumber"><xsl:value-of
    select="floor($lines div 15) + 1"/></xsl:attribute>
    <xsl:apply-templates/>
    <br/>
    </xsl:copy>
    </xsl:template>

    Is "count(line)" returning the count of all lines so far parsed in the
    document, or does it have something to do with the "sentence" tag being
    matched? Also, what does "preceding::line" mean?
    Hey, thanks for all the advice, - Dave
    , Jan 13, 2005
    #1
    1. Advertising

  2. Am 12 Jan 2005 19:46:01 -0800 schrieb :

    > Hello, I am trying to decipher an XSL sheet that is not my own, and
    > yes, I'm a newbie.
    >
    > <xsl:template match="sentence">
    > <xsl:variable name="lines" select="count(line) +
    > count(preceding::line)"/>
    > <xsl:copy>
    > <xsl:attribute name="sectionnumber"><xsl:value-of
    > select="floor($lines div 15) + 1"/></xsl:attribute>
    > <xsl:apply-templates/>
    > <br/>
    > </xsl:copy>
    > </xsl:template>
    >
    > Is "count(line)" returning the count of all lines so far parsed in the
    > document, or does it have something to do with the "sentence" tag being
    > matched? Also, what does "preceding::line" mean?
    > Hey, thanks for all the advice, - Dave


    "count(line)" counts the number of occurrences of the line-nodes embedded
    in the current sentence node. "preceding::line" is an XPathexpression that
    refers to the number of occurrences of the line-tag embedded in the
    preceding sibling of the current sentence node.

    A good place to look for first advice is the online tutorials at
    http://www.w3schools.com/

    -- Sebastian
    Sebastian Millies, Jan 13, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravindra
    Replies:
    2
    Views:
    426
    Ravindra
    Dec 17, 2005
  2. Alec S.
    Replies:
    5
    Views:
    659
    Alec S.
    Sep 11, 2004
  3. Replies:
    1
    Views:
    3,588
    A. Bolmarcich
    May 27, 2005
  4. Replies:
    6
    Views:
    441
    Peter Otten
    May 10, 2007
  5. Hamilton, William

    RE: keyword checker - keyword.kwlist

    Hamilton, William, May 10, 2007, in forum: Python
    Replies:
    4
    Views:
    343
Loading...

Share This Page