xsl-list
[Top] [All Lists]

Re: Stripping empty elements while still conforming to DTD

2005-09-28 08:41:31

<xsl:template match="*">
  <xsl:if test="child::* or (string-length(.) != 0)">
    <xsl:copy>
      <xsl:apply-templates match="@*|node()" />
    </xsl:copy>
  </xsl:if>
</xsl:template>

Though I don't see how this will make sure that the result 'still conforms the 
DTD'...

Cheers

Is there a simple way to strip empty elements from an XML while still 
conforming to the requirements of the DTD?  I know how to use the string() 
function to copy only those elements that contain data, but this often removes 
child elements required by the DTD.

Thanks for your help.

Stone

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>