How does one do a null check for a Guid in xslt?
I am开发者_开发百科 trying to edit an xslt file. One line reads:
<xsl:if test="number(./@LatestAuthor) > 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.
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()]">
精彩评论