XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Matt BSubject: XSLT Newbie Increment Question
Author: Matt B
Date: 23 Feb 2007 11:25 AM

Hey,

I have a dataset containing a number of records.

I am using XSLT to filter out certain records by sending each record through three if tests and displaying if they meet the criteria.

I want to tell the user how many records have been displayed not how many are within the dataset.

I know that variables are not variable and that incrementing is not straight forward. Can anyone give me a pointer on how to do this otherwise simple feat?

The XSLT code goes something like...

<xsl:for-each select="dataSet">
<xsl:if test="fielda != x">
<xsl:if test="fieldb != Y">
<xsl:if test="fieldc != z">
<xsl:value-of select="fieldContents" />
***add a counter here***
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>

On screen I'd then show "counter of dataset total displayed". i.e. "5 of 100 records displayed".

It's all straight forward apart from the counter.

Any help would be gratefully received.

Postnext
(Deleted User) Subject: XSLT Newbie Increment Question
Author: (Deleted User)
Date: 26 Feb 2007 08:37 AM
Hi Matt,
you should generate a node-set containing just the matching nodes:

<xsl:variable name="xx" select="dataSet[fielda!=x][fieldb!=y][fieldc!=z]"/>

then you can output count($xx), or iterate over it using for-each, etc...

Alberto

Posttop
Matt BSubject: XSLT Newbie Increment Question
Author: Matt B
Date: 26 Feb 2007 08:40 AM
Thanks so much for your help!

I'll give it a try.

Thanks again.

Matt

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.