Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


How to select particular items from repeating 'generic' attributes?

From: 42 <nospam@------.--->
To: NULL
Date: 2/6/2006 10:38:00 AM
Hi,
I'm pretty new to XSL, and I've bumped into what is probably (hopefully) 
a simple problem.

I need to convert a simple xml document containing just repeated 
'generic' data blocks of:

<record>
	<data>Bob</data>
	<data>Smith</data>
	...
</record>

to:

<person>
	<firstname>Bob</firstname>
	<lastname>Smith</lastname>
	...
</person>

The source xml contains the same number of  <data> elements for each 
record, are in a consistent order, with no omissions.

I've figured out how to use foreach to iterate over the person records, 
but can't see how to select the nth occurence of <data> within each 
record.

Basically I think I need:

<xsl foreach record>
<person>
	<firstname><xsl valueof "first data"></firstname>
	<lastname><xsl valueof "2nd data"></lastname>
	...
</person
</xsl foreach>

But I've got no idea how to actually get the 'first data', 'second 
data', etc... 

Thanks in advance,
-Dave


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