Subject: Re: [xsl] Move elements to an upper level From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Tue, 13 Mar 2001 13:24:17 +0000 |
Hi Olivier, > In fact, I want to keep the TrafficType element which becomes empty, > and move all the its TrafficTypeValueMap elements at the same level > as TrafficType. > Is it possible to do that ? Sure. Within a template for the parent of the TrafficType element (i.e. the CIM_ActiveConnection element), first apply templates to the TrafficType element, and then to the TrafficType element's child TrafficTypeValueMap elements: <xsl:template match="CIM_ActiveConnection"> <xsl:apply-templates select="TrafficType" /> <xsl:apply-templates select="TrafficType/TrafficTypeValueMap" /> </xsl:template> Now, within the template for the TrafficType element, you want to copy the element itself and its attributes, but leave the content empty: <xsl:template match="TrafficType"> <xsl:copy> <xsl:copy-of select="@*" /> </xsl:copy> </xsl:template> Within the TrafficTypeValueMap template, you want to make a complete copy of the element: <xsl:template match="TrafficTypeValueMap"> <xsl:copy-of select="." /> </xsl:template> The secret is in applying templates to the nodes that you want to process, and in having templates for those nodes do what you want them to do. I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Move elements to an upper lev, Borca, Olivier | Thread | [xsl] preceding-sibling, Borca, Olivier |
Re: [xsl] Re: namespace values, Jeni Tennison | Date | RE: [xsl] preceding-sibling, Borca, Olivier |
Month |