This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Sorting and ordering by attributes


> I've looked through the archives and the FAQ and I can't find anything
> that seems close...although I could be way off in my thought process on
> this one.  Anyway, here's my question:
> 
> I wish to take several tag groups, sort them by 1 attribute, link them
> through another attribute, and only print one of the tags once....confused
> yet?  Seems to me that I need a combination of <xsl:sort>, <xsl:order> and
> <xsl:for-each> but I am really confused as to what combination.
> 
> Here's the code:
> XML:
> <AUTHGRP>
>   <AUTHOR ID="au1" RIDS="aff1">
>     <FNAME>Brian</FNAME>
>     <SURNAME>Smith</SURNAME>
>   </AUTHOR>
>   <AUTHOR ID="au2" RIDS="aff2">
>     <FNAME>Ruth</FNAME>
>     <SURNAME>Jones</SURNAME>
>   </AUTHOR>
>   <AUTHOR ID="au3" RIDS="aff1">
>     <FNAME>Luise</FNAME>
>     <SURNAME>Brown</SURNAME>
>   </AUTHOR>
>   <AFF ID="aff1">
>     <ORGDIV>School of Psychology</ORGDIV>
>     <ORGNAME>University of New England</ORGNAME>
>     <STATE>New South Wales</STATE>
>     <COUNTRY>Australia</COUNTRY>
>   </AFF>
>   <AFF ID="aff2">
>     <ORGDIV>Psychology Department</ORGDIV>
>     <ORGNAME>Yale University</ORGNAME>
>   </AFF>
> </AUTHGRP>
> 
> XSL:
> <xsl:for-each select="ARTICLE/FRONTMAT/AUTHGRP/AUTHOR">
>     <b align="center"><xsl:value-of select="FNAME"/></b>
>     <b><xsl:value-of select="SURNAME"/></b>
>     </xsl:for-each>
>     <br/>
>     
>     <xsl:for-each select="ARTICLE/FRONTMAT/AUTHGRP/AFF">
>       <xsl:value-of select="ORGDIV"/>
>       <xsl:value-of select="ORGNAME"/>
>       <xsl:value-of select="STATE"/>
>       <xsl:value-of select="COUNTRY"/><br/>
>     </xsl:for-each>
> 
> <!--Currently this prints the authors and the affs twice-->
> 
> What it should look like:
> 
> Brian Smith and Luise Brown
> School of Psychology, University of New England, South Wales, Australia
> 
> Ruth Jones
> Yale University
> 
> Any ideas, even something telling me what I am trying to do, would be
> greatly appreciated.  I've been working on this section for a while and if
> I can solve it then I'll have lots of other problems in the same document
> solved as well.
> 
> Thanks!!
> 
> Mark D. Shellenberger
> Electronic Publishing Specialist
> The American Psychological Association
> Washington, DC 20002
> mshellenberger@apa.org
> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]