W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2008

Re: How can I not include empty elements?

From: David Arakelian <david@theatons.com>
Date: Wed, 14 May 2008 17:57:44 +0100
To: www-xsl-fo@w3.org
Message-Id: <1210784264.9635.5.camel@dhopkins-laptop>

You can also do something like this. Forgive me for not using your code,
but I think it would be easier due to its length:

** XML **

<artists>
	<artist>Fela Anikulapo Kuti</artist>
	<artist>Gaspar Lawal</artist>
	<artist></artist>
</artists>

<xsl:for-each select="//artits/artist[text()]">
	<td><xsl:value-of select="." />
</xsl:for-each>

The text() function just selects any node that has text content. I'm not
sure if it will work for whitespace. You can find reference on the XPath
functions here: http://saxon.sourceforge.net/saxon6.5.3/expressions.html

Although I think its rather slim and incomplete.

-- 
      ,'/:.          David Arakelian 
    ,'-/::::.        http://www.theatons.com/
  ,'--/::(@)::.      Web Security Consultant
,'---/::::::::::.    Wales
____/:::::::::::::.  
  T H E A T O N S  
Received on Wednesday, 14 May 2008 16:58:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 14 May 2008 16:58:30 GMT