[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:number query

Subject: RE: xsl:number query
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 8 Mar 2010 22:45:38 -0000
RE:  xsl:number query
<xsl:number 
  count="p[@class='bodytext-directionsrevise'] |
p[@class='bodytext-directionsrule1']" />

Regards,

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

> -----Original Message-----
> From: Terry Ofner [mailto:tdofner@xxxxxxxxx] 
> Sent: 08 March 2010 21:49
> To: ""xsl-list-lists.mulberrytech.co""
> Subject:  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[@class='bodytext-directionsrevise'] | 
> p[@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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.