Results 1 to 3 of 3

Thread: Select exclusive values by means of xsl

  1. #1
    WalkerCook is offline Senior Member
    Join Date
    Dec 2009
    Posts
    253
    Rep Power
    3

    Default Select exclusive values by means of xsl

    I am working on project. I have XSL files that list all the applications. It uses several cases, but the issue is that the same applicant name is repeated that is there is duplication in the result. I want this result in unique values using XSL. I tried number way to solve this problem but none of them worked out. Please help me as soon as possible.

  2. #2
    PerezMorris is offline Senior Member
    Join Date
    Dec 2009
    Posts
    250
    Rep Power
    3

    Default

    Try out this code, when you run this program you get the unique values as a output result:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <catalog>
    <cd country="USA">
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <price>10.90</price>
    </cd>
    <cd country="UK">
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <price>9.90</price>
    </cd>
    <cd country="USA">
    <title>Greatest Hits</title> 
    <artist>Dolly Parton</artist> 
    <price>9.90</price> 
    </cd>
    <cd country="UK">
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <price>9.90</price>
    </cd>
    </catalog>

  3. #3
    HallMiller is offline Senior Member
    Join Date
    Dec 2009
    Posts
    251
    Rep Power
    3

    Default

    Try this Code: which may helpful for you.

    Code:
    <xsl:stylesheet version="1.0"
      xmlns:xsl="address here">
    
      <xsl:output indent="yes" method="txt"/>
      <xsl:key name="vals" match="itms" use="."/>
    
      <xsl:template match="/">
        <xsl:apply-templates select="/root/itms"/>
      </xsl:template>
    
      <xsl:template match="itms">
        <xsl:if test="generate-id() = generate-id(key('vals', normalize-space(.)))">
          <xsl:value-of select="."/>
          <xsl:txt>
    </xsl:txt>
        </xsl:if>
      </xsl:template>
    
      <xsl:template match="txt()">
        <xsl:apply-templates/>
      </xsl:template>
    </xsl:stylesheet>

Similar Threads

  1. FIC SVE00 netbook with a exclusive design
    By Kaiven Boycott in forum Everything Else
    Replies: 0
    Last Post: 01-18-2010, 05:29 AM
  2. What does Benchmarking actually means?
    By annet56 in forum CPU & Components
    Replies: 0
    Last Post: 11-19-2009, 03:56 PM
  3. Windows 7 five exclusive Features
    By Maxtor Quiney in forum Latest Hardware News
    Replies: 0
    Last Post: 06-22-2009, 07:52 AM
  4. Displaying negative time values
    By Jacory666 in forum Windows Vista
    Replies: 0
    Last Post: 12-06-2008, 06:03 AM
  5. Seek out duplicate values
    By fimanson in forum Everything Else
    Replies: 0
    Last Post: 06-23-2008, 04:15 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48