[xsl] Generic Lookup (Element Mapping)

Subject: [xsl] Generic Lookup (Element Mapping)
From: "Faroukh Fekravar" <fekravar@xxxxxxxxxxxxxxxxxx>
Date: Tue, 7 May 2002 08:15:43 -0500
Hi everyone,

I have been trying to write a generic xslt template to map the element names
based on a lookup table.
The lookup xml file has always a subset of the elements and therefore I do
not want to hard code the element names.
The output file is a flat xml file in opposite to the input file.

I have done the part of the key (or at least I think) like

<xsl:variable name="xmlMap" select="document('Lookup.xml')"/>
<xsl:key name="lookup" match="Maps/Map"

But my main problem is how navigate through the input file in a generic
I'm also just a little concern about the overall performance because the
input file might be MBs big.

I would appreciate any help,


data.xml (input)

	<!-- .............. -->

Lookup.xml (It contains the names of the element in the input file and the
matching names in the output)
	<Map>						<!-- combination of SEName, SAname and TEname is unique through
the file.
		<SEname>aa1</SEname>		<!--  element name in the input file
		<SAname>aa11</SAname>		<!-- element name in the input file, it's always
the child element of SEName
		<TEname>aa_1</TEname>		<!-- element name in output
		<TAname>aa_11</TAname>		<!-- element nemae in output, it should be the
child element of TEname
<!-- no mapping for aa22 -->

The output should look like:
	<aa_1A>		<!-- Elelment aa_1 in the source has been mapped to two elements
(aa_1 and aa_1A) in the target-->
		<!-- ................. -->

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread