Navigating sorted XML data (XSLT)
- by Andrew Parisi
I have an XML file with company data in it, for 30 companies across 8 industries, on a portfolio page. The user has the option to sort this data by Industry, and this XML file will be added to constantly.
This sorting is done in my XSL file using <xsl:choose>. Example:
<xsl:when test="(invest[@investid='con'])">
<xsl:for-each select="$invest-port/portfolio/company[@industry='Communications']">
<xsl:sort select="name" />
<div class="invest-port-thumb">
<a>
<xsl:attribute name="href">
<xsl:value-of select="link" />
</xsl:attribute>
</a>
</div>
</xsl:for-each>
</xsl:when>
When navigating to an individual company's page, there are "previous" and "next" buttons at the bottom of the window. My issue is that I need these to dynamically link to the previous and next elements from within the XML data that has been sorted.
Is this possible? Or is there an easier way to do this? (such as place each company in industry-divided XML files instead of one)
Any insight would be greatly appreciated!