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

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!

  • Could you edit your XSLT to show the unquoted XML characters? This is hard to read. :-) Nov 26, 2013 at 15:05
  • I added the same snippet but unquoted Nov 26, 2013 at 15:44
  • Use normal brackets instead of & lt; %gt; and use the code markup functionality in the rich text editor to get it right Nov 26, 2013 at 15:46

1 Answer 1


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">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.