omegared Posted May 16, 2006 Share Posted May 16, 2006 HiI am using xsl:if to output a table only when my current nodes is not empty. The problem is that when the current node is empty, a line appears which I believe is the table border. I don't know why the line is appearing. My code is:Snippet of my xml:<member> <name>John Doe</name> <function>lead</function> <email>jon.doe@killerapp.fun</email> </member> <member> <name>Paul Coder</name> <function>dev</function> <email>paul.coder@killerapp.fun</email> </member>Xslt for table template:<xsl:template match="member"> <xsl:if test='true()'> <fo:block font-size="10pt"> <fo:table border-width="0.1mm" border-style="solid" table-layout="fixed" width="100%"> <fo:table-column column-width="4cm"/> <fo:table-column column-width="4cm"/> <fo:table-column column-width="5cm"/> <fo:table-body> <fo:table-row> <fo:table-cell> <fo:block> <xsl:value-of select="name"/> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> <xsl:value-of select="function"/> </fo:block> </fo:table-cell> <fo:table-cell> <fo:block> <xsl:value-of select="email"/> </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body> </fo:table> </fo:block> </xsl:if></xsl:template> Link to comment Share on other sites More sharing options...
boen_robot Posted May 16, 2006 Share Posted May 16, 2006 I'm not sure, but I think that by using true() you're only checking if the element exists. Or actually you're not checking anything. Try using the sting-lenght() function instead. To be exact: <xsl:when test="string-lenght(current()) > 0"> Link to comment Share on other sites More sharing options...
omegared Posted May 16, 2006 Author Share Posted May 16, 2006 Cheers mate, it worked! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now