Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


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

From: "mark4asp" <mark4asp@-----.--->
To: NULL
Date: 3/4/2008 1:42:00 PM

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>



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent