This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Null Values
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Null Values
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Thu, 29 Mar 2001 16:21:25 +0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
Lawrence:
How about something like --
<xsl:template match="*">
<xsl:if test="normalize-space(.) or node()[not(self::text())]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="comment()|processing-instruction()">
<!-- so that these nodes don't get stripped (delete if you don't want
em) -->
<xsl:copy-of select="."/>
</xsl:template>
?
(Strictly speaking, this does go node by node.)
Good luck,
Wendell
At 07:56 PM 3/29/01, you wrote:
>My requirement is to remove tag names when I convert from one xml to
>another xml, if there is no data.
>e.g
><F1>1234</F1>
><F2>1234</F2>
><F3></F3>
><F4>1234</F4>
>
>to
>
><F1>1234</F1>
><F2>1234</F2>
><F4>1234</F4>
>
>Is there any general method to do this, instead of checking node by node.
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list