Results 1 to 2 of 2

Thread: Distinct values from XML using stylesheet

  1. #1

    Thread Starter
    Addicted Member DJ_Catboy's Avatar
    Join Date
    Jan 2003
    Location
    Suffolk, UK
    Posts
    159

    Distinct values from XML using stylesheet

    Hi,

    I have an XML file as below:

    Code:
    <xml>
      <data>
        <row>1</row>
        <item>xxx</item>
      </data>
      <data>
        <row>2</row>
        <item>yyy</item>
      </data>
      <data>
        <row>3</row>
        <item>xxx</item>
      </data>
    </xml>
    I need to be able to select each of the "item" entries but have a distinct, unique list (i.e. xxx, then yyy) and I am using an xsl:for-each loop:

    Code:
    <xsl:for-each select="/xml/data/row[-- what do I put in here? --]">
    -- code
    </xsl:for-each>
    So if you know SQL, similar to the "select distinct ... " command.

    This is a simplified example of my real application - I know that this can be done many other ways but I need to use a for-each.

    Hoping somebody can help.....

    DJ

  2. #2
    Frenzied Member vbNeo's Avatar
    Join Date
    May 2002
    Location
    Jutland, Denmark
    Posts
    1,994
    if you tried looking at the 'if' function of XSLT? might do what you want
    "Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
    - Zack de la Rocha


    Hear me roar.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width