Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

$4.95 Windows Hosting at Webhost4life.com
  Ads  
Biz Modules provides professional business modules and solutions for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
telerik
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  User Defined Ta...  xsl:if
Previous Previous
 
Next Next
New Post 3/24/2008 3:02 PM
User is offline Mike Riley
245 posts
9th Ranked


xsl:if 

I'm working on a custom XSLT and have hit a snag.  I have a Title column but want to completely hide the title (and line break) when a record has no Title.

 Here's a code snippet:

  <xsl:template match="udt:Data" mode="list">
    <div class="normal">
      <xsl:call-template name="EditLink" />
      <b>
        <xsl:value-of select="udt:Name" disable-output-escaping="yes" />
      </b>
      <br />
      <xsl:if test="@udt:Title">
        <xsl:value-of select="udt:Title" disable-output-escaping="yes" />
        <br />
      </xsl:if>
    </div>
    <br />
  </xsl:template>

The problem I'm having is that it'd completely hiding the Title, whether or not there's a value for Title.  I'm guessing it's probably going to be something real simple.

 
New Post 3/25/2008 12:38 PM
User is offline Brandon Haynes
694 posts
everysport.net
7th Ranked


Re: xsl:if 

Hi Mike,

I have zero experience working with the source UDT XML, but you do have one suspicious issue with your transform: you are looking for the title as an attribute and not an element (you reference Data and Name as an element).  Is it possible that you have an erroneous @ on your xsl:if clause, and it should instead read ... xsl:if test="udt:Title"...?

Brandon


Brandon Haynes
BrandonHaynes.org
 
New Post 3/27/2008 1:57 PM
User is offline Mike Riley
245 posts
9th Ranked


Re: xsl:if 

I finally got it working.  I had to use test="udt:Field!='  ' "  (spacing added between quotes to clarify this on the forums...no spacing between the single quotes).

 

  <xsl:template match="udt:Data" mode="list">
    <div class="normal">
      <xsl:call-template name="EditLink" />
      <b>
        <xsl:value-of select="udt:Name" disable-output-escaping="yes" />
      </b>
      <br />
      <xsl:if test="udt:Title!=''">
        <xsl:value-of select="udt:Title" disable-output-escaping="yes" />
        <br />
      </xsl:if>

      <xsl:if test="udt:Fax!=''">
        Fax: <xsl:value-of select="udt:Fax" disable-output-escaping="yes" />
        <br />
      </xsl:if>
    </div>
    <br />
  </xsl:template>

 
New Post 3/27/2008 4:57 PM
User is offline Brandon Haynes
694 posts
everysport.net
7th Ranked


Re: xsl:if 

Yeah, that was going to be my second suggestion.  Existance of an element (test="element") is different than testing if an element is equal to the empty string (test="element = ''").  Glad you got it working!


Brandon Haynes
BrandonHaynes.org
 
New Post 3/28/2008 1:00 PM
User is offline Mike Riley
245 posts
9th Ranked


Re: Re: xsl:if 

I was just the syntax for "not equals" that was causing the problem.  I'm surprised that syntax isn't listed on more sites/examples of xsl:if.

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  User Defined Ta...  xsl:if
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


DNNSpired.com
Inspired to extend DotNetNuke®, everyday.
www.DNNSpired.com
TMA Resources
TMA Resources is a software company providing eBusiness solutions for the Association market.
www.tmaresources.com
DotNetNuke Hosting Provider UK
UK leading DotNetNuke Hosting provider. Owned and operated by a Microsoft Gold Certified Partner.
www.DNN-Portals.co.uk

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP