xsl-list
[Top] [All Lists]

[xsl] Split with delimiter and remove duplicate with xsl:for-each group

2008-06-30 05:32:38
Hi,

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.

Last week Martin has given a nice solution for splitting as below, I am not
able to use it with <xsl:for-each group>


Input
======
<Article>
   <AuthorList>
   <Author>
    <FirstName>E E</FirstName>
    <LastName>Bosco</LastName>
    <Affiliation>
1Department of Cell and Cancer Biology, University of Cincinnati,
Cincinnati, OH, USA
[2] 4Division of Biomedical Informatics, Cincinnati Children&#39;s Hospital
Medical Center, Cincinnati, OH, USA</Affiliation>
   </Author>
   <Author>
    <FirstName>K</FirstName>
    <LastName>Stengel</LastName>
    <Affiliation>
1Department of Cell and Cancer Biology, University of Cincinnati,
Cincinnati, OH, USA</Affiliation>
   </Author>
   <Author>
    <FirstName>H</FirstName>
    <LastName>Xu</LastName>
    <Affiliation>
 [1] 3Department of Pediatrics, University of Cincinnati, Cincinnati, OH,
USA
 [2] 4Division of Biomedical Informatics, Cincinnati Children&#39;s Hospital
Medical Center, Cincinnati, OH, USA</Affiliation>
   </Author>
</AuthorList>
</Article>



Desired Output
===============

<affiliationlist>
   <affil>1Department of Cell and Cancer Biology, University of Cincinnati,
Cincinnati, OH, USA</affil>
   <affil>4Division of Biomedical Informatics, Cincinnati Children&#39;s
Hospital Medical Center, Cincinnati, OH, USA</affil>
   <affil>3Department of Pediatrics, University of Cincinnati, Cincinnati,
OH, USA</affil>
</affiliationlist>



What I've tried till, which I understand is terribly incorrect, might be in
selection of current-grouping-key(), though trying from few hours (Never
tried xsl:for-each-group before):

Stylesheet
==========

                        <affiliationlist>
                                        <xsl:call-template
name="affiliation"/>    
                        </affiliationlist>




<xsl:template name="affiliation">
<xsl:for-each-group select=".//Affiliation" group-by="./Author/Affiliation">
<xsl:value-of select="current-grouping-key()"/>
 <xsl:for-each select="tokenize(., '\[\d+\]')[normalize-space(.)]">
<affil>
  <xsl:value-of select="normalize-space(current-grouping-key())"/>
</affil>
 </xsl:for-each>
</xsl:for-each-group>
</xsl:template>


Can somebody guide me in this regard.



Best,

Pankaj Chaturvedi

============================================================================
================


Confidentiality Notice:" This message and any attachment(s)
contained here are information that is confidential, proprietary to
IDS Infotech Ltd. and its customers.
Contents may be privileged or otherwise protected by law. The
information is solely intended for the individual or the entity it
is addressed to. If you are not the intended recipient of this
message, you are not authorized to read, forward, print, retain,
copy or disseminate this message or any part of it. If you have
received this e-mail in error, please notify the sender immediately
by return e-mail and delete it from your computer."

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>