Last active
December 11, 2017 11:50
-
-
Save loonix/a0a7b5ee4e79e99a7468542a266a5479 to your computer and use it in GitHub Desktop.
XSL-FO Check if Value is EMPTY or NULL or has a SPACE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Example when tag is like this <Category /> --> | |
<xsl:if test="./Category"> | |
1 | |
</xsl:if> | |
<xsl:if test="not(./Category)"> | |
2 | |
</xsl:if> | |
<xsl:if test="./Category != ''"> | |
3 | |
</xsl:if> | |
<xsl:if test="./Category = ''"> | |
4 | |
</xsl:if> | |
<xsl:if test="./Category = null"> | |
5 | |
</xsl:if> | |
<xsl:if test="not(string(./Category))"> | |
6 | |
</xsl:if> | |
<xsl:if test="not(normalize-space(./Category))"> | |
7 | |
</xsl:if> | |
<xsl:if test="string(number(./Category)) = 'NaN'"> | |
8 | |
</xsl:if> | |
<xsl:if test="./Category/text()"> | |
9 | |
</xsl:if> | |
<xsl:if test="string-length(./Category)"> | |
10 | |
</xsl:if> | |
<!-- 11 - if category is not 0 --> | |
<xsl:if test="string(number(//Category)) != '0'"> | |
<xsl:variable name="altColor"> | |
<xsl:choose> | |
<xsl:when test="position() mod 2 = 0"> white</xsl:when> | |
<xsl:otherwise>#d9d9d9</xsl:otherwise> | |
</xsl:choose> | |
</xsl:variable> | |
<fo:table-cell display-align="center" background-color="{$altColor}"> | |
<fo:block> | |
<!-- This capitalise the first letter --> | |
<xsl:value-of select="translate(substring(./Text1,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" /><xsl:value-of select="translate(substring(./Text1,2,string-length(./Text1)-1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />, | |
<xsl:value-of select="translate(substring(./Text2,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" /><xsl:value-of select="translate(substring(./Text2,2,string-length(./Text2)-1),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment