Reputation:
s0SelectedSite
is an attribute of a class or a column of a table.
<xsl:if test="string-length(@s0SelectedSite) > '0'">
<tr>
<td width="50%" bgcolor="#C0C0C0"><font size="2"><b>Selected Site:</b></font></td>
<td><font size="2"> <xsl:apply-templates select="DBE:Attribute [@name='s0SelectedSite']"/></font></td>
</tr>
</xsl:if>
In the above, the value of s0SelectedSite
exists but still the lines are not getting printed.
For eg. It should display the following:-
Selected Site: Singapore
Please let me know if something is wrong.
Upvotes: 0
Views: 13840
Reputation: 1
Here is how i use it in a template. It matches every @dateEnd that's not empty.
<xsl:template match="@dateEnd[. != '']">
...
</xsl:template>
Upvotes: 0
Reputation:
I tried this way now --> It worked for me :
<xsl:choose>
<xsl:when test="string-length(DBE:Attribute[@name='s0SelectedSite']/node()) > 0">
<table>
...
</table>
</xsl:when>
<xsl:otherwise>
<table>
...
</table>
</xsl:otherwise>
</xsl:choose>
Upvotes: 0
Reputation: 781
I find this generally works for checking to see if a tag is populated
<xsl:if test="@s0SelectedSite !=''">
Could you provide a sample of the xml, as I use this all the time and am wondering if the xpath is the issue.
Upvotes: 2
Reputation: 138097
<xsl:if test="string-length(@s0SelectedSite) > 0">
(and not '0'
).<xsl:if test="@s0SelectedSite">
, see if it's working for you.Upvotes: 1