473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Is there any way to show identical child nodes using xslt?

good day

i am really new to xml and i seem to be stuck. I have the following code:

<product-preference type="not">
<product ref="item1">Shadow Chrome</product>
<product ref="item2">Chrome</product>
</product-preference>

I need to display the "ref" and the description for both items in a browser. However i can't seem to figure it out. I tried an "xsl:for-each" but only the first item appeared. i then used :

<xsl:for-each select="product-preference[@type='not']/product">

to try narrowing the selection down. while this showed the items, i am unable to get the descriptions. Is there anyway to get the items and descriptions for both?? the output i am trying to acheive is:

item1-Shadow Chrome
item2-Chrome

please help. All assistance will be greatly appreciated

recalled1
Jul 9 '08 #1
1 1718
roces
7
Check this transformation.

Expand|Select|Wrap|Line Numbers
  1. <xsl:template match="/">
  2.     <xsl:for-each select="/product-preference[@type='not']/product">
  3.         <xsl:value-of select="concat(@ref, '-', text(), '&#xD;')"/>
  4.     </xsl:for-each>
  5. </xsl:template>
Jul 10 '08 #2

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

Similar topics

9
by: Rolf Kemper | last post by:
Dear Experts, I got stuck with the following problem and need your help. What I wnat to do is to get a set of distinct nodes. Before the distinct I have selected the multiple occourences...
13
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I...
2
by: jon|k | last post by:
hi all-- i need to do a transformation that removes duplicates (among other things). to accomplish that, i'm trying to use for-each-group, but it doesn't work. i need to select for duplicates by...
1
by: treeman | last post by:
I copied the example Compile is successful .net 2003 but i press button , nothing to show but the example has box show up, why ? where 's wrong?
0
by: Treeman | last post by:
I copied the example Compile is successful .net 2003 but i press button , nothing to show but the example has box show up, why ? where 's wrong?
1
by: renfrochris | last post by:
I'm having difficulty finding the correct syntax that will allow me to select a group of invoices based on the total of an amount column located in its line items. Below are simplified examples of...
3
by: gregmcmullinjr | last post by:
Hi All, I would like to use XSLT to replace all <unodes that are children of a <bnode with a new <headingnode. Also, if the <bnode has no other children than remove it as well. For example: ...
1
by: basavaraj koti | last post by:
I need to show image using xslt Below provided in my xml and xslt. <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="../xyz.xsl"?> <Grade class="03"...
4
by: grbeal | last post by:
How do I test for a child element with xsl if condition? We have a vendor application that outputs an XML file containing records of School Closings due to inclement weather. That XML file gets...
6
by: kluge.wolfram | last post by:
Hi, i get stucked on a transformation problem using XSLT. What i need is to copy an XML Tree to an output XML without any automatic changes. Since i used <xsl:copyor <xsl:copy-ofthere occur...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.