That was my first thought but looking at the XML it seems simpler:
Code:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<vehicles>
<xsl:apply-templates select="*/vehicles"/>
</vehicles>
</xsl:template>
<xsl:template match="vehicles">
<xsl:copy-of select="vehiclenumber"/>
<xsl:apply-templates select="../coverages[vehiclenumber = current()/vehiclenumber]"/>
</xsl:template>
<xsl:template match="coverages">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
Personally I think the output is a poor design, it will be difficult to process, especially in XSLT 1.0 as the information is contained somewhat in the position of the elements. Better to surround each vehicle and its coverages with a vehicle element.
--
Joe (
Microsoft MVP - XML)