[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: concatenate multiple attribute values and assign i

Subject: RE: concatenate multiple attribute values and assign it to another attribute
From: "Shaikh, Parvez" <Parvez.Shaikh@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Mar 2007 17:58:25 -0400
RE:  concatenate multiple attribute values and assign i
the xml source looks like

<?xml version="1.0" encoding="utf-8"?>
<payload id="eRequest.Purchase Desktop or Laptop Inventory.Initiate">
    <basicinfo basicinfo_initiatorFullName="Shaikh, Parvez (pshaik) "
basicinfo_initiatorName="pshaik" basicinfo_requestExpectedDate="" />
    <genericrequestdetail genericrequestdetail_description="testing"
genericrequestdetail_include_section="true" />
    <purchasing purchasing_purchasing_status="   "
purchasing_acknowleged="" purchasing_btn_Add_CER_PO=""
purchasing_details="" purchasing_gl_account="1220033 - Compensation
(1220033)" purchasing_capital_sequence_number="8023"
purchasing_gl_project="170010 - ACE System"
purchasing_budget_year="2006" purchasing_item_description="testing"
purchasing_amount="0.00" purchasing_include_section="true">
      <add_CER_PO id="0" cer_number="" cer_created="" po_number=""
po_created="" Vendor="" />
      <cost_allocation_product id="0" project="170025 - Administrative
Services Support" percent="12" />
      <cost_allocation_product id="1" project="171574 - 401(k)
Management System" percent="1" />
      <cost_allocation_product id="2" project="170255 - Fundstation
System" percent="87" />
    <generalcomments generalcomments_comments=""
generalcomments_include_section="true" />
    <attachments attachments_copyToChild="true"
attachments_include_section="true" />
    <promoted-property />

and I am using

<xsl:stylesheet version="1.0"

  <xsl:output method="xml"/>
  <xsl:template match="/">
      <xsl:apply-templates select="//erpayload/* |
<xsl:template match="cost_allocation_product">
      <xsl:attribute name="cost_allocation_product_project">
        <xsl:for-each select="//cost_allocation_product">
          <xsl:value-of select="@project"/>
          <xsl:if test="position()!=last()">,</xsl:if>
      <xsl:attribute name="cost_allocation_product_percent">
        <xsl:for-each select="//cost_allocation_product">
          <xsl:value-of select="@percent"/>
          <xsl:if test="position()!=last()">,</xsl:if>


-----Original Message-----
From: Shaikh, Parvez
Sent: Thursday, March 29, 2007 5:53 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  concatenate multiple attribute values and assign it
to another attribute

The reason I did that change was when I change it to testnode instead of
//testnode it does not output anything of testnode. Please note that
this is a part of a big xsl stylesheet that I am using.
It begins as
<xsl:template match="/">
      <xsl:apply-templates select="//erpayload/* |

testnode is at erpayload/purchasing/testnode

I cannot change this as it affects many other xml forms

-----Original Message-----
From: Abel Braaksma [mailto:abel.online@xxxxxxxxx]
Sent: Thursday, March 29, 2007 5:41 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  concatenate multiple attribute values and assign it
to another attribute

Shaikh, Parvez wrote:
> based on michael kay response or abels response if I do, the problem
> I get 4 outputs of testnode
> i.e
> <testnode att1="1,2,3,4" att2="a,b,c,d" />
> <testnode att1="1,2,3,4" att2="a,b,c,d" />
> <testnode att1="1,2,3,4" att2="a,b,c,d" />
> <testnode att1="1,2,3,4" att2="a,b,c,d" />
> I want it to output only once.
> This is what I have done based on michaels response. The following is
> portion of the xslt file I have.
>  <xsl:template match="//testnode">
>    <testnode>
>  ....

This is not how (we / I) suggested it. You are matching for each and
every testnode here (it is never needed to have a match="//xyz", use
match="xyz" instead, which acts equally), of course you will create a
new node each time a 'testnode' is encountered. This is the reverse of
our solutions.

Please try our examples, they work 'out of the box' with the input you
gave us, and go from there.

The information contained in this transmission may be privileged and
confidential and is intended only for the use of the person(s) named
above. If you are not the intended recipient, or an employee or agent
for delivering this message to the intended recipient, any review,
distribution or duplication of this communication is strictly
prohibited. If you are
not the intended recipient, please contact the sender immediately by
reply e-mail
and destroy all copies of the original message. Please note that we do
not accept
account orders and/or instructions by e-mail, and therefore will not be
for carrying out such orders and/or instructions.  If you, as the
intended recipient
of this message, the purpose of which is to inform and update our
clients, prospects
and consultants of developments relating to our services and products,
would not
like to receive further e-mail correspondence from the sender, please
"reply" to the
sender indicating your wishes.  In the U.S.: 1345 Avenue of the
Americas, New York,
NY 10105.

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.