[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Split with delimiter and remove duplicate with xs

Subject: Re: Split with delimiter and remove duplicate with xsl:for-each group
From: Deborah Pickett <debbiep-list-xsl@xxxxxxxxxx>
Date: Mon, 30 Jun 2008 22:48:34 +1000
Re:  Split with delimiter and remove duplicate with  xs
Hi Pankaj,

Pankaj Chaturvedi wrote:
I am trying to use the combination of <xsl:for-each-group> to avoid
duplicate and split data of <Affiliation> , using [number] as the delimiter.

This looks like a problem for distinct-values() rather than for-each-group.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"

<xsl:output indent="yes"/>

    <xsl:template match="/Article">
        <xsl:variable name="affiliations" as="xs:string+">
            <xsl:for-each select="//Affiliation">
                <xsl:analyze-string select="string(.)"
                        <xsl:if test="normalize-space(.)">
                            <xsl:sequence select="normalize-space(.)"/>

            <xsl:for-each select="distinct-values($affiliations)">
            <affil><xsl:value-of select="."/></affil>

<?xml version="1.0" encoding="UTF-8"?>
<affil>1Department of Cell and Cancer Biology, University of Cincinnati, Cincinnati, OH, USA</affil>
<affil>4Division of Biomedical Informatics, Cincinnati Children's Hospital Medical Center, Cincinnati, OH, USA</affil>
<affil>3Department of Pediatrics, University of Cincinnati, Cincinnati, OH, USA</affil>

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.