I'm having issues with the rows inside my form. When there are two AML parts and three documents, the second document row is blank. I'm not sure what is causing this. Thank you for your help.
Search
<Item type="Part" action="GetItemRepeatConfig" select="item_number,name,major_rev,classification" id="{@id}">
<Relationships>
<Item type="Part AML" select="state,related_id(item_number,manufacturer)"/>
<Item type="Part Document" select="state,related_id(item_number,name,major_rev)"/>
<Item type="Part BOM" select="sort_order,quantity,reference_designator,related_id" repeatProp="related_id" repeatTimes="5"/>
</Relationships>
</Item>
Style Sheet
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:aras="http://www.aras-corp.com">
<xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes"></xsl:output>
<xsl:template match="/">
<html>
<head></head>
<style type="text/css" userData="Global">
table {empty-cells:show; border-collapse:collapse;}
th {font-family:helvetica; font-size:8pt; padding:2px; border:1px #000000 solid; background-color:#CCCCCC; text-transform:capitalize;}
td {font-family:helvetica; font-size:8pt; padding:2px; border:1px #000000 solid;}
td.noBorder {font-family:helvetica; font-size:8pt; padding:2px; border-width:0;}
</style>
<body topmargin="50" leftmargin="50">
<table border="0" cellspacing="0" cellpadding="0" width="1850">
<tr valign="top">
<td class="noBorder" align="left" colspan="9" uniqueID="ms__id21">
<img src="../images/Logos/CooperPowerSystems.gif" height="60"></img>
</td>
</tr>
<tr valign="bottom">
<td class="noBorder" colspan="13" style="font-family:helvetica;font-size:15pt;color:#DA1943;padding:2px;" align="left" uniqueID="ms__id22">Bill of Materials Report - <xsl:value-of select="//Item/name"></xsl:value-of> Rev <xsl:value-of select="//Item/major_rev"></xsl:value-of>
</td>
<td class="noBorder" colspan="7" style="font-family:helvetica;font-size:10pt;padding:2px;" align="right" uniqueID="ms__id23">Generated on: <script>function m00(r, n){r += ""; if (!n) n = 2; while(r.length < n){r = "0" + r;} return r;} var dt = new Date(); var a = top.opener.top.aras; if (a){var s = m00(dt.getUTCFullYear(),4)+"-"+m00((dt.getUTCMonth()+1))+"-"+m00(dt.getUTCDate())+"T"+m00(dt.getUTCHours())+":"+m00(dt.getUTCMinutes())+":"+m00(dt.getUTCSeconds())+"+0000"; s = a.convertToNeutral(s, "date", "yyyy-MM-ddTHH:mm:sszzz"); s = a.convertFromNeutral(s, "date", "short_date"); document.write(s);}</script>
</td>
</tr>
<tr>
<th colspan="6">Indenture Level</th>
<th>Part Number</th>
<th>Legacy Part Number</th>
<th>Revision</th>
<th>Name</th>
<th>Description</th>
<th>Parameters</th>
<th>RoHS/Pb-Free</th>
<th>Quantity</th>
<th>Reference Designator</th>
<th>AML Status</th>
<th>Manufacturer</th>
<th>Manufacturer Part</th>
<th>Document Number</th>
<th>Document Name</th>
<th>Document Rev</th>
<th>Pos AML</th>
<th>Pos Doc</th>
</tr>
<xsl:apply-templates select="//Item[@type='Part']"></xsl:apply-templates>
</table>
</body>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
</html>
</xsl:template>
<xsl:template match="Item[@type='Part']">
<xsl:variable name="Depth" select="count(ancestor::Item[@type='Part'])"></xsl:variable>
<xsl:variable name="AML">
<xsl:choose>
<xsl:when test="count(Relationships/Item[@type='Part AML'])=0">1</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(Relationships/Item[@type='Part AML'])"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="Doc">
<xsl:choose>
<xsl:when test="count(Relationships/Item[@type='Part Document'])=0">1</xsl:when>
<xsl:otherwise>
<xsl:value-of select="count(Relationships/Item[@type='Part Document'])"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="rowCount">
<xsl:choose>
<xsl:when test="$AML <= $Doc"><xsl:value-of select="$Doc"></xsl:value-of></xsl:when>
<xsl:otherwise>
<xsl:value-of select="$AML"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id10">
<xsl:if test="$Depth=0">0</xsl:if>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id11">
<xsl:if test="$Depth=1">1</xsl:if>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id12">
<xsl:if test="$Depth=2">2</xsl:if>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id13">
<xsl:if test="$Depth=3">3</xsl:if>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id14">
<xsl:if test="$Depth=4">4</xsl:if>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id15">
<xsl:if test="$Depth=5">5</xsl:if>
</td>
<td rowspan="{$rowCount}" width="5%" align="center" uniqueID="ms__id16">
<xsl:value-of select="item_number"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="2%" align="center" uniqueID="ms__id18">
<xsl:value-of select="major_rev"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="13%" align="center" uniqueID="ms__id19">
<xsl:value-of select="name"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="13%" align="center" uniqueID="ms__id20">
<xsl:value-of select="description"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="5%" align="center" uniqueID="ms__id22">
<xsl:value-of select="rohs_pb_free"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="5%" align="center" uniqueID="ms__id23">
<xsl:choose>
<xsl:when test="$Depth=0">1</xsl:when>
<xsl:when test="$Depth!=0 and (../../quantity)=''">1</xsl:when>
<xsl:otherwise>
<xsl:value-of select="../../quantity"></xsl:value-of>
</xsl:otherwise>
</xsl:choose>
</td>
<td rowspan="{$rowCount}" width="5%" align="center" uniqueID="ms__id24">
<xsl:value-of select="../../reference_designator"></xsl:value-of>
</td>
<td width="5%" align="center" uniqueID="ms__id25">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/state"></xsl:value-of>
</td>
<td width="13%" align="center" uniqueID="ms__id26">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/related_id/Item/manufacturer/@keyed_name"></xsl:value-of>
</td>
<td width="13%" align="center" uniqueID="ms__id27">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/related_id/Item/item_number"></xsl:value-of>
</td>
<td width="5%" align="center" uniqueID="ms__id28">
<xsl:value-of select="Relationships/Item[@type='Part Document'][1]/related_id/Item/item_number"></xsl:value-of>
</td>
<td width="13%px" align="center" uniqueID="ms__id29">
<xsl:value-of select="Relationships/Item[@type='Part Document'][1]/related_id/Item/name"></xsl:value-of>
</td>
<td width="8%" align="center" uniqueID="ms__id30">
<xsl:value-of select="Relationships/Item[@type='Part Document'][1]/related_id/Item/major_rev"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="8%" align="center" uniqueID="ms__id37">
<xsl:value-of select="count(Relationships/Item[@type='Part AML'])"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" width="8%" align="center" uniqueID="ms__id38">
<xsl:value-of select="count(Relationships/Item[@type='Part Document'])"></xsl:value-of>
</td>
</tr>
<xsl:apply-templates select="Relationships/Item[@type='Part AML'][position()!=1] | Relationships/Item[@type='Part Document'][position()!=1]"></xsl:apply-templates>
</xsl:template>
<!-- Selects AML data for each row -->
<xsl:template match="Item[@type='Part AML'] | Item[@type='Part Document']">
<tr>
<td width="5%" align="center" uniqueID="ms__id31">
<xsl:value-of select="state"></xsl:value-of>
</td>
<td width="13%" align="center" uniqueID="ms__id32">
<xsl:value-of select="related_id/Item/manufacturer/@keyed_name"></xsl:value-of>
</td>
<td width="13%" align="center" uniqueID="ms__id33">
<xsl:value-of select="related_id[@type='Manufacturer Part']/Item/item_number"></xsl:value-of>
</td>
<td width="5%" align="center" uniqueID="ms__id34">
<xsl:value-of select="related_id[@type='Document']/Item/item_number"></xsl:value-of>
</td>
<td width="13%" align="center" uniqueID="ms__id35">
<xsl:value-of select="related_id[@type='Document']/Item/name"></xsl:value-of>
</td>
<td width="8%" align="center" uniqueID="ms__id36">
<xsl:value-of select="related_id/Item/major_rev"></xsl:value-of>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>