File Link

File Link

File Link

Filefield types, as well as Image and General Link fields, represent their value using a single XML element with a number of attributes. Pass a third parameter to sc:fld() to retrieve the value of a specific attribute. The sc:fld()method returns the value of a field but does not include markup to support inline editing if the content author is in the Page Editor

Use the sc:fld() method to retrieve the src attribute from the field value - replace fieldname with the name of the File fieldtype


C# Web Control Code

<xsl:variable name="src" select="sc:fld('fieldname',$sc_currentitem,'src')" />

 <xsl:if test="$src">

      <a href="{concat('/',$src)}">

            <xsl:value-of select="concat('/',$src)" />

       </a>

 </xsl:if>