Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsDefault Sort Order?Default Sort Order?
Previous
 
Next
New Post
7/6/2012 5:16 PM
 

Dnn 6.1
News 4.2.1

I have a feed, that when displayed in the News module, the order is being changed from the original source. Here is the feed: http://www.amazon.com/rss/new-releases/dvd?tag=thedycom-20

When I view it in a browser, the order is correct, but when the module processes it, the order is changed. This list is a top ten type list so the order is important. I'm guessing that there is some logic to use the pubDate, and since they all have the same, the original order is lost somehow.

Any ideas on how to address this to use the original sort order?

Thanks in advance,

Chad

 
New Post
7/6/2012 6:13 PM
 
Well, I have sort of an idea. The title field has the rank in the first positions like "#1: XXXX". I can substring the title to get the rank and then sort by that....but not sure you can do that in the same xsl or you need to pre-process it first. I'm guessing you need to pre-process it, but have no idea how to write an xsl to do that?

Here is what I tried, but the sorting doesn't work...I don't think you can sort on a custom derived variable like I am attempting.


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="html" indent="yes"/>
 <xsl:param name="ItemsToShow"/>
 <xsl:param name="ShowItemDetails"/>
 <xsl:param name="ShowItemDate"/>
 <xsl:param name="Locale"/>
 <xsl:param name="Target"/>
 <xsl:template match="rss">

         
     
         <xsl:for-each select="channel/item" >
            
            <xsl:sort select="rank" data-type="number" order="ascending" />
            
            <xsl:variable name="rankStartPosn" select="string-length(substring-before(title, '#'))+1"/>
            <xsl:variable name="rankEndPosn" select="string-length(substring-before(title, ':'))+1"/>
            <xsl:variable name="rank" select="substring(title,number($rankStartPosn), number($rankEndPosn)-number($rankStartPosn))"/>
            
             <xsl:if test="position()&lt;=$ItemsToShow or $ItemsToShow&lt;1" >
                <h4>
                <a href="{link}">
                    <xsl:attribute name="target"><xsl:value-of select="$Target"/></xsl:attribute>
                    <xsl:value-of select="title"/>
                </a>
                </h4>
                <xsl:if test="$ShowItemDate='true'">
                    <h6>
                        <xsl:value-of select="pubDate"/>
                    </h6>
                </xsl:if>
                <xsl:if test="$ShowItemDetails='true'">
                    <p class="Normal">
                        <xsl:value-of select="$rank"/>
                        <xsl:value-of select="description" disable-output-escaping="yes"/>
                    </p>
                </xsl:if>
            </xsl:if>
        </xsl:for-each>
     
    </xsl:template>
</xsl:stylesheet>







































 
New Post
7/6/2012 7:34 PM
Accepted Answer 

Ah...epiphany! Just don't use variables and put the entire expression in the sort's select...like:

<xsl:sort data-type="number" order="ascending" 

                 select="substring(title,number(string-length(substring-before(title, '#'))+2), number(string-length(substring-before(title, ':'))+1)-number(string-length(substring-before(title, '#'))+2))"/>

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsDefault Sort Order?Default Sort Order?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out