views:

63

answers:

1

I am trying to edit an xslt file. One line reads:

<xsl:if test="number(./@LatestAuthor) &gt; 0">

The issue I have is that latest author used to be of type int and is now a nullable Guid. How can I edit the xslt file to check if @LatestAuthor is not null? Thanks.

A: 
  • If you just want to test to see whether there is a @LatestAuthor attribute(with or without a value) use this: <xsl:if test="@LatestAuthor">

  • If you want to test to see whether @LatestAuthor exists AND has a value, you can use this: <xsl:if test="@LatestAuthor[.!='']">

  • If you want to test to see whether @LatestAuthor is present AND has a non-whitespace value, you can use this: <xsl:if test="@LatestAuthor[normalize-space()!='']">

  • If you want to test to see whether @LatestAuthor is present AND has a numeric value, you can use this: <xsl:if test="@LatestAuthor[number()]">

Mads Hansen