Help interpreting XSL count keyword

L

laredotornado

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
 
S

Sebastian Millies

Am 12 Jan 2005 19:46:01 -0800 schrieb (e-mail address removed):
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top