Subject: RE: [xsl] xsl:number query From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 8 Mar 2010 22:45:38 -0000 |
<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] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:number query, G. Ken Holman | Thread | [xsl] Reading and writing into the , Tom T |
Re: [xsl] XML access control by cus, Michael Ludwig | Date | Re: [xsl] Display the number of rec, anil kumar |
Month |