Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


sorting and filtering oh my!

From: snafu7x7 <scottandrewmacdonald@-----.--->
To: NULL
Date: 10/2/2007 6:17:00 PM

 Hope someone in here can help me with this one, its got me stumped.

I have XML data for a CD collection and a stylesheet that I have setup
to sort it as need be (i.e. by artist, by album name, etc). However,
since the library is rather large I want the stylesheet to be able to
accept parameters for a range of items to return (say the first 100,
or the last 50, or whatever). How can I accomplish this in conjunction
with my sorting?

Here is some sample XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<library>
<album>
<ID>1234</ID>
<Name><![CDATA[Paul's Boutique]]></Name>
<Artist><![CDATA[The Beastie Boys]]></Artist>
<Genre><![CDATA[Rap/Hip-Hop]]></Genre>
<Rating>8.5</Rating>

</album>

<album>
<ID>5678</ID>
<Name><![CDATA[Document]]></Name>
<Artist><![CDATA[R.E.M]]></Artist>
<Genre><![CDATA[Rock]]></Genre>
<Rating>7</Rating>

</album>

<album>
<ID>9988</ID>
<Name><![CDATA[Kind Of Blue]]></Name>
<Artist><![CDATA[Miles Davis]]></Artist>
<Genre><![CDATA[Jazz]]></Genre>
<Rating>8.9</Rating>

</album>

</library>


And my stylesheet (note the variables I have declared for start and
end index):

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output encoding="utf-8" method="xml" indent="yes"/>

<xsl:param name="startIndex" select="0" />
<xsl:param name="endIndex" select="10" />

<xsl:template match="library">

<xsl:copy>
<xsl:apply-templates>
<xsl:sort data-type="text" select="Artist" order="ascending"/>
</xsl:apply-templates>
</xsl:copy>

</xsl:template>

<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent