Re: [xsl] xslt adds elements twice in xml.

Subject: Re: [xsl] xslt adds elements twice in xml.
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Thu, 17 Feb 2005 17:33:21 -0600
> I looked, but I could not find any other template with the enablePortlet
> node, i found the following which I do not think should matter --
> <xsl:template match="*">
> <xsl:copy>
> <xsl:copy-of select="@*"/>
> <xsl:apply-templates/>
> </xsl:copy>
> </xsl:template>
> 

This actually makes quite a difference.

In your initial template you had an <xsl:apply template/> with the
<xsl:copy>.  This will apply any matching templates to the children
nodes.  Since the template you just gave will match any element, and
elementPool is a child element of portlet, it has this template
applied to it.  And this template copies the current element and then
apply-templates to the children.  (I don't know if the description I
gave follows the XLST terminology exactly, but it's close enough for
our purpose here).

You might wish to add templates that say <xsl:template
match="enablePortlet"/> and <xsl:template match="sessionPortlet"/> but
I would recommend rewriting it so you pull the templates out of the
initial one similar to my previous email.


Jon Gorman

Current Thread