Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XSL sorting of results from recursive calls to document()? XSL sorting of results from recursive calls to document()?To: NULL Date: 10/5/2008 9:11:00 PM Hello --
I am trying to use XSL to process Amazon wishlist data to sort the
results by type (Apparel, then Books, then DVDs, etc). Amazon's web
services chunk up results in multiple pages of fixed size, e.g. 55
items gets returned in 5 XML pages of 10 items and a 6th of 5 items.
Each page is returned from a distinct URL call with a PageNum
parameter.
I've been trying to adapt a technique described at http://www.xefer.com/amazon/wishlist
that shows how to iterate through such pages through recursive
document() calls and a document counter:
<xsl:template name="counter">
<xsl:param name="total"/>
<xsl:param name="page"/>
<xsl:variable name="lookup"
select="concat($lookup, '&ProductPage=', $page)
<xsl:if test="$page <= $total">
<xsl:apply-templates select="document($lookup)"/>
<xsl:call-template name="counter">
<xsl:with-param name="total" select="$total"/>
<xsl:with-param name="page" select="$page + 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
This works, but I can't figure out how to sort the aggregate results.
Each document's nodes are processed separately before the next page is
retrieved. Is there a convention / idiom for how to handle sorting
when iterating via recursion across multiple document() calls?
Thanks,
Ramon
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
