Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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 FeedsXSL TemplatesXSL Templates
Previous
 
Next
New Post
1/5/2007 6:08 PM
 

Hi,

Does anyone know where I can find a repository of xsl templates. I've been been trying to display a different background color for every other record but not sure if that is possible.

Thanks,
Jon

 
New Post
2/13/2007 6:55 PM
 
Jon,

Not sure if you ever sorted this, but I believe this is possible using the following:
    <xsl:attribute name="class">
      <xsl:choose>
        <xsl:when test="position()mod 2">oddrows</xsl:when>
        <xsl:otherwise>evenrows</xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
This should create alternate rows with classes of "oddrows" and "evenrows" obviously renamable to anything.

Kind regards

Pete

Aarrgghhh! User Error DNN Version: 4.4/4.5
Websites: taxinumber.com/taxi-today.com
Like DNN? Yes! Very much, congratulations!
Poor eyesight? Yes! Thankyou very much!
 
New Post
3/15/2007 1:23 PM
 

Not to be glib, but the only place use to be my website, which is down currently.  I'm working on putting a zip file together that will include examples and some tutorials on how to use them in DNN.  Much of the infomation was available on the older forums, and others have used some in creating info on their websites.  DNNCreative is a good example, Lee took some forum posts and solutions offerred by a few of us and really gave RSS, XML, and XSL a very good treatment.

Lots has changed in the RSS world over the years, and new challenges pop up.  IE7 and FireFox, now allow feeds to be auto-discovered, and displayed, but that doesn't mean you don't want to know how to leverage this powerful module for your DNN site.

Anyway, I've got an example that does render items with alternating background colors, it is possible.  I'll look for it and post it, give us a bit to find it.

Cheers,

iwonder

 
New Post
3/15/2007 2:01 PM
 

As promised, here's an example xsl that does alternating item background colors.  Remember, when you use it to turn off the module setting for display container or you may not get the effect you want.  Experiment with the color and then you can use your container.

It's much the same as what Peter offered, just a complete xsl.  In it, I do reference some <div class> tags, but these are ignored.  You can add style descriptions embedded in your xsl or reference them, but that's another example. Just something to be mindful.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<!-- RSSv2.0 Simple XSL with alternating item background colors Example by Phil 'iwonder' Guerra -->
<xsl:template match="/">
 <div>
  <xsl:apply-templates select="rss/channel"/>
  </div>
</xsl:template>
<xsl:template match="rss/channel">
<xsl:variable name="link" select="link"/>
  <xsl:variable name="description" select="description"/>
  <xsl:variable name="image" select="image/url"/>
  <xsl:variable name="idesc" select="image/description"/>
  <xsl:variable name="ilink" select="image/link"/>
  <xsl:variable name="iwide" select="image/width"/>
  <xsl:variable name="ihigh" select="image/height"/>

<div class="head">
 <xsl:if test="$image">
 <a href="{$ilink}" title="{$idesc}"><xsl:value-of select="ilink" /></a>
 <img src="{$image}" height="{$ihigh}" width="{$iwide}" style="float: left; margin: 2px; border: 0px;"/>
 </xsl:if>
 <font size="-2"><xsl:value-of select="description"/><br/>
     <a href="{$link}"><xsl:value-of select="title" /></a><br/>
 <xsl:value-of select="webMaster"/><br/>
 <xsl:value-of select="copyright"/></font>
 <hr/>
</div>

 <xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
  <xsl:variable name="item_link" select="link"/>
  <xsl:variable name="item_title" select="description"/>
  <xsl:variable name="ikeyinfo" select="description"/>
<!--  <xsl:variable name:"idTitle" select="concat(substring-before($ikeyinfo,'&#59;'),title)" -->
<div>
  <xsl:if test="position() mod 2 != 0">
    <xsl:attribute  name="style">background-color: #F5F5F5</xsl:attribute>
  </xsl:if>
  <div class="IssueSubject">
      <a href="{$item_link}"> <xsl:value-of select="title" disable-output-escaping="yes"/></a>
      </div>

   <div class="IssuePubDate">
      <xsl:value-of select="pubDate"/>
   </div>  
     
   <div class="IssueInfo">
      <xsl:value-of select="substring-before($ikeyinfo,'&lt;br&gt;')"/>
   </div>

   <div class="IssueText">
      <xsl:value-of select="substring-after(description,'&lt;br&gt;&lt;br&gt;')" disable-output-escaping="yes"/>
   </div>

</div>
   <hr/>
</xsl:template>
</xsl:stylesheet>

 

 
New Post
4/12/2007 1:25 AM
 

Thanks for posting the great example--

 

It works perfectly !

 



 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsXSL TemplatesXSL Templates


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