Thread: XSL questions

    #1
  1. a lazy guy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Hong Kong
    Posts
    99
    Rep Power
    13

    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.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    4
    Rep 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>


IMN logo majestic logo threadwatch logo seochat tools logo