RE: [xsl] output node-set

Subject: RE: [xsl] output node-set
From: "Bondarenko, Taras" <TBondarenko@xxxxxxxx>
Date: Fri, 1 Apr 2005 14:29:54 -0500

>you solution worked

Actually you can simplify the second template:

	<xsl:template match="*">
		xsl:copy-of select="self::*[normalize-space(.) != '']"/>

>but as i mentioned that i need to keep some empty nodes as a reference

I don't see that you mentioned it anywhere

>so i  just need to delete the empty nodes that called <dig >

If this is not what you need then clarify what do you call "empty node".
Since all this template does is not copying nodes with empty text()

If you want to make it generic so and not copy a node with NO children
at all, just change the predicate to [not(node())]


First of, you XML is not valid. Second if all you need is to ignore
nodes with empty strings it can be done simpler.

    <xsl:template match="/top">
    <xsl:template match="*">
        <xsl:if test="normalize-space(.) != ''">
            <xsl:copy-of select="."/>



i got the following xml database result from a privious transformation
which contains some  empty nodes :


and i am trying from the following template to transform the above
database to a form where we get red of all the empty <dig> elements only
but it has a problem which  i can not figure what was it

 <xsl:template match="path">
 <xsl:for-each select="*">

 <xsl:when test="'self::dig'">
 <xsl:copy-of select="dig[node()]"/>

<xsl:when test="'self::nondig'">
 <xsl:copy-of select="nondig[node()]""/>

<xsl:when test="'self::CCTo'">
<CCTo />

<xsl:when test="'self::MoTo'">
<MoToTo />




Current Thread