Results 1 to 2 of 2

Thread: XML Filtering on Unique ID with XSL

  1. #1

    Thread Starter
    Addicted Member jeroenh's Avatar
    Join Date
    Aug 2000
    Location
    Rotterdam, Holland
    Posts
    201

    Exclamation XML Filtering on Unique ID with XSL

    I have a XML document that looks like the following

    <xmlrootnode>
    <person>
    <childeren>
    <child>
    <id>1</id>
    </child>
    </childeren>
    </person>
    <person>
    <childeren>
    <child>
    <id>2</id>
    </child>
    </childeren>
    </person>
    <person>
    <childeren>
    <child>
    <id>2</id>
    </child>
    </childeren>
    </person>
    </xmlrootnode>

    I need to convert this to the following:
    <person>
    <childeren>
    <child id="1"/>
    <child id="2"/>
    </childeren>
    </person>

    As you can see I want to filter on ID and discard any doubles.
    Has anybody have an idea to solve this. I don't want to use JavaScript within the XSL.

    Greetings,


    Jeroen
    Catch you later,

    Jeroen Hoekemeijer
    Code:
    If 1 = 2 Then MajorError

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Three Anchor Bay, Cape Town, South Africa
    Posts
    769
    The filter part is easy, just use a xsl parameter and use that in your xsl template.

    I have done something similar before but dont have the code with me at the moment. I do remember though that I used xml key functions to remove the duplicates.

    Just a quick question... Do you use any tools to produce your xslt or are you hardcore and type it out manually?

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