xsl-list
[Top] [All Lists]

RE: [xsl] xsl:number query

2010-03-08 16:46:06

<xsl:number 
  count="p[(_at_)class='bodytext-directionsrevise'] |
p[(_at_)class='bodytext-directionsrule1']" />

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

-----Original Message-----
From: Terry Ofner [mailto:tdofner(_at_)gmail(_dot_)com] 
Sent: 08 March 2010 21:49
To: ""xsl-list-lists.mulberrytech.co""
Subject: [xsl] xsl:number query

I am having trouble getting an accurate count using xsl:number.

Here is a snippet of my input document:

<div class="story">
                              <p class="test">A</p>
                              <p 
class="head-testname">READING COMPREHENSION</p>
                              <p 
class="bodytext-directionsrevise">Directions: Read the 
selection. Then answer the questions that follow.</p>
                              <p 
class="head-selectiontitle">Jason and the Golden Fleece</p>
                                    ...
                              <p 
class="bodytext-directionsrule1">Directions: Read the 
selection. Then answer the questions that follow.</p>
                              <p 
class="head-selectiontitle">Freight</p>
                              <p 
class="bodytext-selectionintro">This is an ... Underground 
Railroad.</p>
                              <p 
class="bodytext-subhead">Cast of Characters</p> </div>

I am attempting to include in the same sequence both <p 
class="bodytext-directionsrevise"> and <p class="bodytext- 
directionsrule1">.

Here is the relevant template from my 2.0 stylesheet:

<xsl:template match="p[(_at_)class='bodytext-directionsrevise'] | 
p[(_at_)class='bodytext-directionsrule1']">
<narrative>
      <xsl:attribute name="name"><xsl:number select="." count="*"  
from="story"></xsl:number></xsl:attribute>
<xsl:apply-templates/>
</narrative>
</xsl:template>


Apparently, I am counting <p> elements, as indicated by this result
snippet:

<story>
             <test>A</test>
             <head-testname>READING COMPREHENSION</head-testname>
             <narrative name="3">Directions: Read the 
selection. Then answer the questions that follow.</narrative> ...
             <narrative name="82">Directions: Read the 
selection. Then answer the questions that follow.</narrative>

How can I tell xsl:number to count the specified attributes?

Terry


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>