Products

Solutions

Learn More

Partners

Community

Blog

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 FeedsPlease Help me with xsl  !Please Help me with xsl !
Previous
 
Next
New Post
2/1/2012 1:05 PM
 

Ok... let's say I only want titles and pub date... this is teh default XSL file:

 <?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="limit">3</xsl:param>
  <xsl:param name="ItemsToShow"/>
  <xsl:param name="ShowItemDetails"/>
  <xsl:param name="ShowItemDate"/>
  <xsl:param name="Locale"/>
  <xsl:template match="rss">
    <xsl:for-each select="channel/item[position()&lt;=$ItemsToShow or $ItemsToShow&lt;1]">
      <p class="DNN_News_ItemLink">
        <a href="{link}" target="_main">
          <xsl:value-of select="title"/>
        </a>
      </p>
      <xsl:if test="$ShowItemDate='true'">
        <p class="DNN_News_ItemDate">
          <xsl:value-of select="pubDate"/>
        </p>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet> 

 I added this line:

<xsl:param name="limit">3</xsl:param>

 It ignore this and displays everything - not just the three... what I am doing wrong here? Thanks for the insight.

 
New Post
2/1/2012 1:22 PM
 
Not an expert but shouldn't that be < xsl:param name="limit" select="3"/ >?
 
New Post
2/1/2012 2:54 PM
 
Pingle wrote:
Not an expert but shouldn't that be < xsl:param name="limit" select="3"/ >?

Pingle thanks for the advice... but I tried this and it still shows everything... can anyone explain how to only allow this to only show three items:

<?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="limit" select="3"/>
  <xsl:param name="ItemsToShow"/>
  <xsl:param name="ShowItemDetails"/>
  <xsl:param name="ShowItemDate"/>
  <xsl:param name="Locale"/>
  <xsl:template match="rss">
    <xsl:for-each select="channel/item[position()&lt;=$ItemsToShow or $ItemsToShow&lt;1]">
      <p class="DNN_News_ItemLink">
        <a href="{link}" target="_main">
          <xsl:value-of select="title"/>
        </a>
      </p>
      <xsl:if test="$ShowItemDate='true'">
        <p class="DNN_News_ItemDate">
          <xsl:value-of select="pubDate"/>
        </p>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
 

 
New Post
2/1/2012 4:37 PM
 
You added the parameter of limit with a value of 3, but did not use it anywhere.  Looks like you do not even need it because the xml that you have appears to have the functionality you are looking for.  The parameter ItemsToShow is used on the for-each-select statement to limit the number of items.  You could just add a value of 3 to that parameter.  Without a value of 1 or greater, all of the items are shown. 

Change:
<xsl:param name="ItemsToShow"/>
To:
<xsl:param name="ItemsToShow">3</xls:param>
 
New Post
2/1/2012 4:46 PM
 

I did this and got the following error on the page where the News module is placed:

System.Xml.Xsl.XslLoadException
XSLT compile error.

<?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">3</xls:param>
  <xsl:param name="ShowItemDetails"/>
  <xsl:param name="ShowItemDate"/>
  <xsl:param name="Locale"/>
  <xsl:template match="rss">
    <xsl:for-each select="channel/item[position()&lt;=$ItemsToShow or $ItemsToShow&lt;1]">
      <p class="DNN_News_ItemLink">
        <a href="{link}" target="_main">
          <xsl:value-of select="title"/>
        </a>
      </p>
      <xsl:if test="$ShowItemDate='true'">
        <p class="DNN_News_ItemDate">
          <xsl:value-of select="pubDate"/>
        </p>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

 Sorry this is not my area of expertise...

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsPlease Help me with xsl  !Please Help me with xsl !


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