Re: How can I not include empty elements?

On May 14, 2008, at 5:50 AM, jlr wrote:

> I have an XML document that will display the elements as shown below.
> Basically, the elements are a subset of the <row> tag.  The elements
> will always have the tag names of column1, column2, column3, and  
> column4.
> As shown in the example below, some of the tag names column1, etc. may
> have elements, and some of the tag names for column1, etc. may be  
> empty
> elements.  I have only given one listing of empty elements, but this  
> could
> be up to
> 50 empty elements.  When creating the PDF document in xslt, is there  
> a way
> of  removing
> the empty elements so that they won't display?
> I have the xslt code after the xml detail.

Okay, first of all you should be doing this, e.g.:

	<xsl:apply-templates select="column1"/>

instead of

	<xsl:value-of select="column1"/>

Once you have fixed that, then just add this template:

	<xsl:template match="row/*[not (normalize-space (.))]"/>	<!-- kill  
empty columns -->


HTH,
—ml—

Received on Wednesday, 14 May 2008 13:22:19 UTC