Re: [xsl] Add an element that contains multiple nested elements

Subject: Re: [xsl] Add an element that contains multiple nested elements
From: "Jon Gorman" <jonathan.gorman@xxxxxxxxx>
Date: Tue, 16 May 2006 10:50:12 -0500
This is the result I need to achieve:

<rootElement>
 <container>
  <element1>
    <elementA>A</elementA>
  </element1>
...
  <element2>
    <elementB>B</elementB>
  </element1>
 </container>
</rootElement>

Ummm, so


<xsl:template match="rootElement">
<container>
<xsl:apply-templates />
</container>
</xsl:template>

?

Typically I'd try to explain what's happening instead of just
responding to code, but I'm not entirely sure what you did to get your
mistaken output.

Probably something like:
<xsl:template match="rootElement/*">
<container>
<xsl:apply-templates />
</container>
</xsl:template>

If you did, then you need some review on the basics of XPath.
Otherwise you might be abusing for-each.  But this really is a simple
problem.

Jon Gorman.

Current Thread