Solved

Hide field when it has no value

Posted on 2007-12-07
2
714 Views
Last Modified: 2013-11-18
Experts,

On our sharepoint intranet site we changed the XSL of the people searh results like this:

        <font color="#FF6633">Title: </font>
        <xsl:if test='string-length($title) &gt; 0'>
         <xsl:value-of select="$title" /><br />
        </xsl:if>

        <font color="#FF6633">Department: </font>
        <xsl:if test='string-length($dep) &gt; 0'>
         <xsl:value-of select="$dep" /> <br />
        </xsl:if>

        <font color="#FF6633">Office Nr.: </font>
        <xsl:if test='string-length($phone) &gt; 0'>
         <xsl:value-of select="$phone" /><br />
        </xsl:if>

But when a user eg. does not have an office nr, the word "Office Nr.:" is still visible, how can I hide it when it has no value

thx in advance
0
Comment
Question by:ITBenelux
2 Comments
 
LVL 13

Accepted Solution

by:
R7AF earned 300 total points
ID: 20426876
How about including the text in the xsl-if?
<xsl:if test='string-length($phone) &gt; 0'>

         <font color="#FF6633">Office Nr.: </font>

         <xsl:value-of select="$phone" /><br />

</xsl:if>

Open in new window

0
 
LVL 1

Author Comment

by:ITBenelux
ID: 20426903
Simple :-) you just need to know it.... thank for the quick answer. !
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now