ASP Error: 70
Description: Permission denied
Source: Microsoft VBScript runtime error
|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Yet Another Sorting Problem
Hi Allin,
With the help of nodeset function, the problem is
easy to solve. Following stylesheet could be helpful -
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan">
<xsl:output method="xml" />
<xsl:template match="/bibliography">
<xsl:variable name="rtf">
<xsl:for-each select="book|journalarticle|paper">
<xsl:element name="{name()}">
<auhash>
<xsl:for-each select="authorlist/author">
<xsl:value-of select="@surname"/>
<xsl:value-of select="@initials"/>
</xsl:for-each>
</auhash>
<pubdate>
<xsl:value-of select="pubdate" />
</pubdate>
<!-- put anything else -->
</xsl:element>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="xalan:nodeset($rtf)/*">
<xsl:sort select="auhash" />
<xsl:sort select="pubdate" />
<!-- do required processing -->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Regards,
Mukul
--- Allin Cottrell <cottrell@xxxxxxx> wrote:
> I've consulted the FAQ, but I'm having difficulty
> extrapolating to the
> answer to this one.
>
> In sorting a bibliography, I want to sort the
> elements (e.g. books,
> articles) by author's name and publication date.
> OK, that's easy.
> My problem is handling multiple authors, with the
> the number unknown
> in advance. For flexibility in formatting the
> authors' names I can't
> have them all in one big string; the data-structure
> I actually have is
> this:
>
> * each bibliography-entry element has an
> "authorlist" element.
> * an authorlist has one or more "author" elements,
> which have
> attributes such as surname, fist name, initials.
>
> The easy solution, if it were available, would be to
> wrap the xsl:sort
> selection code in an xsl:for-each ranging across the
> authors in an
> entry's authorlist, but that's forbidden by xsl
> syntax.
>
> Next thought: construct on the fly a "grand author
> string" by lumping
> together the names and initials of all the authors
> in an entry's
> authorlist, and use this as the sort key for the
> entries.
>
> Seems promising, but I haven't managed to implement
> it. What I have
> so far is broken -- I realize I can't use
> xsl:attribute to do this,
> but I'm not sure what I should be using.
>
> <xsl:template match="bibliography">
> <xsl:for-each select="book|journalarticle|paper">
> <xsl:attribute name="auhash">
> <xsl:for-each select="authorlist/author">
> <xsl:value-of select="@surname"/>
> <xsl:value-of select="@initials"/>
> </xsl:for-each>
> </xsl:attribute>
> </xsl:for-each>
> <xsl:apply-templates
> select="book|journalarticle|paper">
> <xsl:sort select="@auhash"/>
> <xsl:sort select="pubdate"/>
> </xsl:apply-templates>
> </xsl:template>
>
> --
> Allin Cottrell
> Department of Economics
> Wake Forest University, NC
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
|
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
|

Cart








