[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: What is the simplest method for using xsl:sort wi
Hello Martin,
After I was told you had answered, I found your email in the junk. Sorry I missed it the first time. I am reconstructing the original sequence of journal articles from a <List> of non-sequential <Items>. My task is to sort the several hundred <Items>in a <List> container by Year, Issue Number, and Page. In the example below, only one <Item> is shown. I tried the template you suggested. As before, in the output I get a concatenation of the attribute values in the tags that have attributes. See <Cat> and <Person> illustrated as input and output below: Thanks, Mark You suggested: <xsl:template match="*"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates> <xsl:sort select="Article/Year" /> <xsl:sort select="Article/IssueNumber"/> <xsl:sort select="Article/Page" /> </xsl:apply-templates> </xsl:copy> </xsl:template> My input: <List> <Item> <Cat pofis="4" pofis-number="116"/> <Subject>Errors</Subject> <Subject>Color Errors</Subject> <Subject>Olympic Games. Atlanta</Subject> <Article> <Person>Fritz, Zdenek</Person> <Person is-author="false">Kleskovic, Peter Z.</Person> <Title>Imperfect color se-tenant</Title> <Year>2000</Year> <IssueNumber>1</IssueNumber> <IssueName>Jan/Feb</IssueName> <Page>10</Page> </Article> </Item> </List> The output from your template: <List> <Item> <Cat>4116</Cat> <Subject>Errors</Subject> <Subject>Color Errors</Subject> <Subject>Olympic Games. Atlanta</Subject> <Article> <Person>Fritz, Zdenek</Person> <Person>falseKleskovic, Peter Z.</Person> <Title>Imperfect color se-tenant</Title> <Year>2000</Year> <IssueNumber>1</IssueNumber> <IssueName>Jan/Feb</IssueName> <Page>10</Page> </Article> </Item> </List>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|