Re: [xsl] Output multiple occurence into one and concatenate values

Subject: Re: [xsl] Output multiple occurence into one and concatenate values
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 29 Mar 2007 21:19:12 +0200
Shaikh, Parvez wrote:
Thanks for all the responses.

I am using at the top

<xsl:template match="/">
    <erpayload>
      <xsl:apply-templates select="//erpayload/* | //erpayload/*/*"/>
    </erpayload>
  </xsl:template>



so All I did based on what you said was:

<xsl:template match="cost_allocation_product">


This is not enough. You should have a place where you *apply* the templates. Or even only the attributes, if you want more fine-grained control. I.e.:


<xsl:apply-templates select="somenode/@Product" />

Then, you create the matching template

<xsl:template match="@Product" />

To get all the nodes from a certain context and all its descendants, you can use //somenode/@Product in the apply-templates. The same you can do with other attributes. To create an attribute, do like I told you, add an xsl:attribute around the apply-templates that does the selection.

If you have trouble understanding how apply-templates and matching templates work together, you should consider any of many tutorials or books. Without understanding matching templates, it will be very hard to understand XSLT and to make it work for you.

-- Abel

Current Thread