Xslt for displaying childnode subnode information

Hi all,

this is quite a toughie to explain what i want to achieve so ill try use some screen shots to help you understand my issue.

So.. i have the following tree structure

Our vehicles = vehicleArea doctype
Mercedes,Ford,Vauxhall = vehicleManufacturer doctype
16 seater, 8 seater, 6 seater = vehicleProfile doctype

On the Our vehicles page i would like to display three seperate div’s (for each manufacturer) and within these divs i would like to display the manufacturerName and manufacturerInformation (pulled in from from the vehicle manufacturer doc type) and also a list of each manufacturer child nodes along with a coverImage and vehicleName which is pulled from vehicleProfile doc type.

So i have the following xslt (which may be a bit messy but kind of works)

    <xsl:param name="currentPage"/>
<xsl:template match="/">
	
		<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> 
		<article class="vehicle-list-item">
			                <xsl:if test="position() mod 4 = 0">
                    <xsl:attribute name="class">driver-profile-item last</xsl:attribute>
                </xsl:if>
			<!--<h3 class="hidden"><xsl:value-of select="@nodeName"/></h3>-->	
			<figure>
				
				<xsl:if test="number(manufacturerImage) &gt; 0">
					<xsl:variable name="selectedMedia" select="umbraco.library:GetMedia(manufacturerImage, 0)" />					
    				<img src="{$selectedMedia/umbracoFile}?width=245&amp;height=160&amp;mode=crop" alt="{$currentPage/@nodeName}" title="{@nodeName}" />
				</xsl:if>
				
				<xsl:if test="string(manufacturerImage) =''">					
					<img src="/images/awaiting-image.png?width=245&amp;height=160&amp;" alt="{$currentPage/@nodeName}" title="Awaiting image for {@nodeName}" />					
				</xsl:if>	
				</figure>
			
				<h5><xsl:value-of select="manufacturerName"/></h5> <!--a href="{umbraco.library:NiceUrl(@id)}"></a>-->
				<xsl:if test="manufacturerInformation !=''">    				
					<xsl:value-of select="manufacturerInformation" disable-output-escaping="yes"/>


					<xsl:for-each select="$currentPage/VehicleManufacturer/* [@isDoc and string(umbracoNaviHide) != '1']">
						<xsl:if test="number(coverImage) &gt; 0">
					<xsl:variable name="coverImage" select="umbraco.library:GetMedia(coverImage, 0)" />					
    				<img src="{$coverImage/umbracoFile}?width=245&amp;height=160&amp;mode=crop" alt="{$currentPage/@nodeName}" title="{@nodeName}" />
						<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="vehicleName"/></a>							
				</xsl:if>
						
				<xsl:if test="string(coverImage) =''">					
					<img src="/images/awaiting-image.png?width=245&amp;height=160&amp;" alt="{$currentPage/@nodeName}" title="Awaiting image for {@nodeName}" />					
					<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="vehicleName"/></a>							
				</xsl:if>
						
					</xsl:for-each>
					
					
				</xsl:if>
			
				<xsl:if test="string(manufacturerInformation) =''">
					<p>Awaiting information for </p>
					<p><xsl:value-of select="manufacturerName"/></p>
				</xsl:if>			
			
 </article>	 
</xsl:for-each>
</xsl:template>

My problem at the moment is the foreach loop to list the manufacturerChild nodes and inforamtion. It is just duplicating all the information and i cant work out why (this will be my lack of knowledge in xslt). This is what i am seeing

Hopefully this makes sense to someone as im really struggling to work out whats happening. Maybe i need two seperate xslt files?

Thanks

Paul


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/61691-xslt-for-displaying-childnode-subnode-information