473,503 Members | 10,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Concatinating 2 tags inside the same node with xslt XSLT

1 New Member
Hi All,

I just started working with XSLT, so this question might be obvios for some; i'm struggling trying to concatenate 2 tags inside the same node. I will be receiving one XML file and my output is another XML file.

This is a sample of the xml i will be receiving:
Expand|Select|Wrap|Line Numbers
  1. <EquipmentList>
  2.     <EquipmentDetail>
  3.     <AssetSupplierName>Dealer 1</AssetSupplierName>
  4.     <Quantity>1</Quantity>
  5.                 <Specification>Asset 1</Specification>
  6.     </EquipmentDetail>
  7.     <EquipmentDetail>
  8.     <AssetSupplierName>Dealer 2</AssetSupplierName>
  9.     <Quantity>1</Quantity>
  10.                  <Specification>Asset 2</Specification>
  11.     </EquipmentDetail>
  12.     <EquipmentDetail>
  13.     <AssetSupplierName>Dealer 3</AssetSupplierName>
  14.     <Quantity>1</Quantity>
  15.                 <Specification>Asset 3</Specification>
  16.     </EquipmentDetail>
  17. <EquipmentList>
This is the code i have:
Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="//Specification">
  2.     <xsl:copy>
  3.         <xsl:copy-of select="concat(., ' ', //EquipmentDetail/AssetSupplierName)"/>
  4.     </xsl:copy>
  5. </xsl:template>
The problem im having is that it always concatenates to Specification to the same AssetSupplierName Tag, i always get

Asset 1 Dealer 1
Asset 2 Dealer 1
Asset 3 Dealer 1

when im really expecting

Asset 1 Dealer 1
Asset 2 Dealer 2
Asset 3 Dealer 3

I have tried putting the same code above inside a for-each and i get the same results...

Thanks in advance!
Oct 26 '09 #1
1 2148
Dormilich
8,658 Recognized Expert Moderator Expert
you have to move (via XPath) from the current node, not from the root node (i.e. //*).
Expand|Select|Wrap|Line Numbers
  1. ../preceding-sibling::AssetSupplierName[1]
(something like that)
Oct 26 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4709
by: Mike Conmackie | last post by:
Hi Folks, I've probably omitted something very basic but I have no idea what it might be. The results of my transformation _should_ be an xml file but all I get is the xml declaration...
2
5045
by: Joe | last post by:
How would you preserve tags from an XML element in XSLT output.. Example: XML document has an ELEMENT "SECTION" allowing contained HTML This element might have an element such as <A...
1
1536
by: bjam | last post by:
Hi, I am trying to create a sort of include file into my xsl files such that calling the following template will push these xml tags into my document such that the other xsl files can use these...
3
1295
by: ree32 | last post by:
I am new to XSL but I need to create a display where the layout is <tr> <td> <item/ ></td> <td> <item/ ></td> </tr> <tr> <td> <item/ ></td> <td> <item/ ></td> </tr> and so on .. A column...
4
1787
by: dwergkees | last post by:
Hi, Got a litte problem here. I'm trying to create a XSLT file that will do a transformation from WordML format (MS Word XML format, see...
2
2253
by: Andy | last post by:
Hi, I have an ASP.NET webpage that contains an ASP.NET XML control. This control accepts an XSLT stylesheet and XML document which it then uses to render HTML code where the XML control is...
2
2105
by: gregmcmullinjr | last post by:
I am wondering if there is a way to use a DTD or Schema to instruct an XML parser to ignore tags that are not defined. That is, if my list of acceptable tags is <bodyand <content>, then in the...
1
4489
by: patelgaurav85 | last post by:
Hi, I want to convert xml in one format into another xml format shown below Input xml : <Name> <Name1> <Name11>Name11</Name11> <Name12>Name12</Name12>
1
1872
by: Sharat Koya | last post by:
I have a the following xml node. <doc tag1="a" tag2="b" tag3="c" docTag1="d" docTag2="e"/> I would like to output "abc" I have the following XPATH2.0 so far //doc/@*] which returns a...
0
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7095
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7294
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7361
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7015
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3183
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1523
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
403
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.