Skip to Content
0
Former Member
Feb 24, 2009 at 12:55 AM

Repeat Root element for each child element XSLT

230 Views

I need to repeat the top level element for each child element.

My structure is

<Sensor xmlns=namespace>

<Observation>

<XML> some data </XML>

</Observation>

</Sensor

Observation is 1:n, I need sensor to repeat every observation.

Currently i have for-each loop that places the document in the following structure

<Sensor xmlns=namespace>

<Observation>

<XML> some data </XML>

</Observation>

<Observation>

<XML> some data </XML>

</Observation>

<Observation>

<XML> some data </XML>

</Observation>

<Observation>

<XML> some data </XML>

</Observation>

</Sensor>

How do I get Sensor to repeat without error? I am using XSLT.

I get this error when i tried puting sensor tag part of the loop

Only one top level element is allowed in an XML document. Error processing resource 'file:///...

<pmlcore:Sensor xmlns:pmlcore="urn:autoid:specification:interchange:PMLCore:xml:schema:1" xmlns:pmluid="urn:autoid:specif...