开发者

How does one do a null check for a Guid in xslt?

开发者 https://www.devze.com 2022-12-30 20:05 出处:网络
I am开发者_开发百科 trying to edit an xslt file. One line reads: <xsl:if test=\"number(./@LatestAuthor) &gt; 0\">

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.


  • 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()]">

0

精彩评论

暂无评论...
验证码 换一张
取 消