473,394 Members | 1,706 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,394 software developers and data experts.

How do I extract a repeating attribute value out to display it only once (using XSLT 1.0).

Apologies, I just can't get my head around xslt but I need to do this.

I have an xml file with two attributes per product. One of the
attributes repeats to produce several groups (3 in the example, grouped
by region). How can I select this repeating attribute out as a header
column in a table with the other attribute as in a data column. (see
example html). XSLT 1.0 solutions only please (or whatever is
compatible with current major browser parsers [FF, IE6, IE7, Opera,
Safari]).

source xml:

<sales>
<product region="NW" item="Drill" />
<product region="NW" item="Fork" />
<product region="NW" item="Spade" />
<product region="SE" item="Brick" />
<product region="SE" item="Hammer" />
<product region="SE" item="Nail" />
<product region="SW" item="Chisel" />
<product region="SW" item="Screw" />
</sales>

target html:

<html>
<body>
<table>
<tr><th>NW</th></tr>
<tr><td>Drill</td></tr>
<tr><td>Fork</td></tr>
<tr><td>Spade</td></tr>
<tr><th>SE</th></tr>
<tr><td>Brick</td></tr>
<tr><td>Hammer</td></tr>
<tr><td>Nail</td></tr>
<tr><th>SW</th></tr>
<tr><td>Chisel</td></tr>
<tr><td>Screw</td></tr>
</table>
</body>
</html>

Mar 4 '08 #1
1 3421
In article <02**********************@news.astraweb.com>,
mark4asp <ma******@gmail.comwrote:
>I have an xml file with two attributes per product. One of the
attributes repeats to produce several groups (3 in the example, grouped
by region). How can I select this repeating attribute out as a header
column in a table with the other attribute as in a data column.
You may find this helpful:

http://www.jenitennison.com/xslt/grouping/muenchian.xml

-- Richard
--
:wq
Mar 4 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Iain | last post by:
I want to create an XML configuration file which might look like <REGION Name="Europe" WingDing="Blue"> <COUNTRY Name="UK" WingDing="white"> <TOWN Name="London" WingDing="Orange" /> </COUNTRY>...
9
by: Stefan Franke | last post by:
Hi, I've got the following simple XSLT stylesheet, that lists all the values of the elements of any given XML file. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0"...
2
by: Keith Chadwick | last post by:
Is there a way to append to an attribute in XSLT. For example: <input name="emailaddress" style="width:200px"> <xsl:apply-templates select="//object"/> </input> <xsl:template...
11
by: Christoph Boget | last post by:
When building a form using Infopath, you can define a repeating section and stick form fields in that section. I'm curious if ASP.NET has a similar control to make it easy to design something...
1
by: arnold | last post by:
Hi, I've been knocking my head against the wall trying to create an XSL transform to perform "normalizations" of a set of XML files that have a common structure. % XML file before transform
5
by: patrin | last post by:
Hi All, given the source document: <?xml version="1.0" encoding="UTF-8"?> <root> <child> <test id="1" name="first child"/> </child> <child>
9
by: gregmcmullinjr | last post by:
Hello, I am new to the concept of XSL and am looking for some assistance. Take the following XML document: <binder> <author>Greg</author> <notes> <time>11:45</time>
3
by: 张韡武 | last post by:
Hello. I am a newbie trying to get my first XLST script working. I already know how to do this: Source XML: <category id="a0104"> <name>Oil and Gas</name> </category> XSLT: <xsl:for-each...
1
by: boetke | last post by:
Hi all, I am attempting to create an xslt transformation which I am having trouble with. I am fairly new to xslt and am having a hard time getting my head around it. The original xml file looks...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...

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.