Sunday, February 16, 2014

SharePoint 2010 Data View Webpart Displying URL Field

In SharePoint 2010, while displaying URL columns/fields, We can use @FiledName.desc.

Below is the example.



<xsl:choose>
      <xsl:when test="@OtherUrl1 != '' ">
           <div ><a  target="_blank"  href="{@OtherUrl1}">
                   <xsl:value-of select="@OtherUrl1.desc"/>
                </a>
          </div>
       </xsl:when>
     <xsl:otherwise>
     </xsl:otherwise>
</xsl:choose>





The below code doesn't work, if you have tried already.



<a href="{substring-before(@OtherUrl1,',')}" style="border:none !important;">
            <xsl:value-of select="substring-after(@OtherUrl1,',')"/>
 </a>