« Return to Thread: How can I not include empty elements?

Re: How can I not include empty elements?

by David Arakelian :: Rate this Message:

Reply to Author | View in Thread


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  


 « Return to Thread: How can I not include empty elements?