XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 6th, 2002, 03:07 AM
sunnychan's Avatar
sunnychan sunnychan is offline
a lazy guy
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 99 sunnychan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
XSL questions

Hello,

I dont know how to make a number list based on some condition in XSL.

For example, it prints the Filename only when the 'FileStatus = 1'

eg.

<xsl:for-each select="./Files/File">
<xsl:if test="./FileStatus = 1">
No. <xsl:value-of select="position()"/>
Filename: <xsl:value-of select="./Filename"/>
</xsl:if>
</xsl:for-each>


The above codes will print

No.1
Filename: FileA.txt
No.5
Filename: FileB.txt

and that is not my desired result.
I want the 'No.' print in the order 1,2,3,4 ....
eg.

No.1
Filename: FileA.txt
No.2
Filename: FileB.txt


Anyone got some solution here?
Thanks.

Reply With Quote
  #2  
Old February 7th, 2002, 04:21 AM
mrtom mrtom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 4 mrtom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<xsl:variable name="print" select="Files/File[FileStatus = 1]"/>

<xsl:for-each select="$print">
No. <xsl:value-of select="position()"/>
Filename: <xsl:value-of select="./Filename"/>
</xsl:for-each>


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XSL questions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway