Re: [xsl] Grouping multiple tags into one parent tag

Subject: Re: [xsl] Grouping multiple tags into one parent tag
From: Chad Chelius <cchelius@xxxxxxxxxx>
Date: Sun, 15 Feb 2009 13:11:47 -0500
Thank you all for your responses. Ken this is exactly what I was trying to do! The only thing is, I am also using:

<xsl:output method="xml" cdata-section-elements="field"/>

To wrap the contents of the field element in a cdata tag. After using the template rule that you provided, that cdata-section-element no longer works. I'm not sure why.


<chad/>


Chad Chelius
Adobe Certified Instructor
Adobe Certified Expert
AGI Training
cchelius@xxxxxxxxxx

See me at the CRE8 Conference
www.CRE8summit.com
April 15-16 at the Walt Disney World Resort






On Feb 15, 2009, at 1:03 PM, G. Ken Holman wrote:


Re-reading your post, perhaps you meant the following:

 <xsl:template match="body">
   <xsl:if test="not(preceding-sibling::body)">
      <field name="body">
         <xsl:for-each select="../body">
            <p>
               <xsl:apply-templates/>
            </p>
         </xsl:for-each>
      </field>
   </xsl:if>
 </xsl:template>

This would produce:

 <field name="body">
   <p>content here</p>
   <p>content here</p>
   <p>content here</p>
 </field>

Current Thread