Navigating sorted XML data (XSLT)

Posted by Andrew Parisi on Stack Overflow See other posts from Stack Overflow or by Andrew Parisi
Published on 2010-05-10T17:52:11Z Indexed on 2010/05/10 17:54 UTC
Read the original article Hit count: 193

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xslt