Question

I have the following xsl snippet from a standard web part that gets its data (image, header, text) from the Pages library, specifically the part that checks the image:

<xsl:choose>
  <xsl:when test"$Img=1">
    <div class="NewsStartArchiveImage" style="height:170px"><xsl:value-of select="@Img" disable-output-escaping="yes"/>
    </div>
  </xsl:when>
  <xsl:otherwise>
    <div class="NewsStartArchiveImage" style="height:20px">
    </div>
  </xsl:otherwise>  
</xsl:choose>

what i want to do with the snippet is simply looking if there is a picture attached with the NewsPage.aspx layout throw a column called Img during the page creation, if there is an image set the height to 170px, and if not, set the height to 20px. This snippet causes the web part to fail. Am I missing something? Please ask me if this looks unfairly explained.

Thanks in advance!

Was it helpful?

Solution

Assuming that your criterion for chosing the format is the existence of the @Img attribute you will have to rewrite your test expression to

<xsl:when test="@Img">
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top