我正在尝试在与子节点相同的行中重复父节点。我有用于创建报告的数据,当前样式表以及我想要的外观。我一直无法找到解决方案。如果您需要更多信息,请与我们联系。感谢您的帮助,非常感谢。
数据
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<Result>
<Item type="Part">
<description>AML test</description>
<id keyed_name="E008643" type="Part">57022FEA23B54493B691386368F5DFBB</id>
<major_rev>1</major_rev>
<name>9.6 Parts</name>
<item_number>E008643</item_number>
<Relationships>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<item_number>1804</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id>
<Item type="Manufacturer Part">
<item_number>JNED</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part BOM">
<quantity>1</quantity>
<related_id keyed_name="E000371" type="Part">
<Item type="Part">
<description>Part 1</description>
<name>0</name>
<item_number>E000371</item_number>
<Relationships>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Speer" type="Manufacturer"></manufacturer>
<item_number>RK7D</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Ven" type="Manufacturer"></manufacturer>
<item_number>CR00T</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Sonic" type="Manufacturer"></manufacturer>
<item_number>ERJ</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Comp" type="Manufacturer"></manufacturer>
<item_number>NRCF</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Ya" type="Manufacturer"></manufacturer>
<item_number>RC0L</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
</Relationships>
</Item>
</related_id>
<sort_order>128</sort_order>
</Item>
<Item type="Part BOM">
<quantity>30</quantity>
<related_id keyed_name="E001163" type="Part">
<Item type="Part">
<description>Part 2</description>
<name>82</name>
<item_number>E001163</item_number>
<Relationships>
<Item type="Part AML">
<related_id keyed_name="ECH-U1C822GX5" type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Sonic" type="Manufacturer"></manufacturer>
<item_number>E2GX5</item_number>
</Item>
</related_id>
<state>Preliminary</state>
</Item>
<Item type="Part AML">
<related_id type="Manufacturer Part">
<Item type="Manufacturer Part">
<manufacturer keyed_name="Sonic" type="Manufacturer"></manufacturer>
<item_number>EGX5</item_number>
</Item>
</related_id>
<source_id keyed_name="E001163" type="Part"></source_id>
<state>Preliminary</state>
</Item>
</Relationships>
</Item>
</related_id>
<sort_order>256</sort_order>
</Item>
</Relationships>
</Item>
</Result>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
当前样式表
<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">
.cellSolid {text-align:center;border-top:1px #000000 solid;border-right:1px #000000 solid;border-bottom:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidTopRight {border-top:1px #000000 solid;border-right:1px #000000 solid;}
.cellSolidTopLeft {border-top:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidRightBottom {border-right:1px #000000 solid;border-bottom:1px #000000 solid;font-family:helvetica;font-size:8pt;}
.cellSolidBottomLeft {border-bottom:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidTop {border-top:1px #000000 solid;}
.cellSolidRight {border-right:1px #000000 solid;}
.cellSolidBottom {border-bottom:1px #000000 solid;}
.cellSolidLeft {border-left:1px #000000 solid;}
.cellDashed {border-top:1px #666666 dashed;border-right:1px #666666 dashed;border-bottom:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedTopRight {border-top:1px #666666 dashed;border-right:1px #666666 dashed;}
.cellDashedTopLeft {border-top:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedBottomRight {border-bottom:1px #666666 dashed;border-right:1px #666666 dashed;}
.cellDashedBottomLeft {border-bottom:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedTop {border-top:1px #666666 dashed;}
.cellDashedRight {border-right:1px #666666 dashed;}
.cellDashedBottom {border-bottom:1px #666666 dashed;}
.cellDashedLeft {border-left:1px #666666 dashed;}
.cellHeader {background-color:#CCCCCC;border-top:1px #000000 solid;border-right:1px #000000 solid;border-bottom:1px #000000 solid;padding:2px;text-align:center;text-transform:capitalize;text-align:center;font-family:helvetica;font-weight:bold;font-size:8pt;}
.cellTitle {border-top:1px #000000 solid;border-right:1px #000000 solid;border-left:1px #000000 solid;padding:2px;text-align:center;text-transform:capitalize;text-align:center;font-family:helvetica;font-weight:bold;font-size:8pt;}
table {empty-cells:show; border-collapse:collapse;}
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="100%">
<tr>
<td width="150" uniqueID="ms__id11"></td>
<td width="250" uniqueID="ms__id12"></td>
<td width="200" uniqueID="ms__id13"></td>
</tr>
<tr valign="top">
<td align="left" uniqueID="ms__id14" colspan="3">
<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__id15">AML Quantity 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="4" style="font-family:helvetica;font-size:10pt;padding:2px;" align="right" uniqueID="ms__id16">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>
<td class="cellHeader" style="border-left:1px #666666 solid;" uniqueID="ms__id17">Part Number</td>
<td class="cellHeader" uniqueID="ms__id18">Name</td>
<td class="cellHeader" uniqueID="ms__id32">Description</td>
<td class="cellHeader" uniqueID="ms__id19">Calculated Quantity</td>
<td class="cellHeader" uniqueID="ms__id20">AML Status</td>
<td class="cellHeader" uniqueID="ms__id21">Manufacturer</td>
<td class="cellHeader" uniqueID="ms__id22">Manufacturer Part</td>
</tr>
<xsl:call-template name="main"></xsl:call-template>
</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>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<script src="../../javascript/PopupMenu.js"></script>
<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 name="main">
<xsl:variable name="products"><!-- generate appropriate product for every item-->
<xsl:call-template name="Unique"></xsl:call-template>
</xsl:variable>
<xsl:for-each select="//Item//Item[@type='Part']">
<xsl:variable name="id" select="@id"></xsl:variable>
<xsl:variable name="part_number">
<xsl:value-of select="item_number"></xsl:value-of>
<xsl:if test="item_number='' or not(item_number)">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="part_name">
<xsl:value-of select="name"></xsl:value-of>
<xsl:if test="name='' or not(name)">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="part_description">
<xsl:value-of select="description"></xsl:value-of>
<xsl:if test="description='' or not(description)">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:variable>
<xsl:variable name="is_first" select="count(ancestor::Item[@type='Part' and @id=string($id)] | preceding::Item[@type='Part' and @id=string($id)])"></xsl:variable>
<xsl:if test="$is_first = 0">
<xsl:variable name="sum_of_products" select="sum(msxsl:node-set($products)/product_for_item[item_id = $id]/product)"></xsl:variable>
<xsl:call-template name="draw_row_for_item">
<xsl:with-param name="id" select="$id"></xsl:with-param>
<xsl:with-param name="sum_of_products" select="$sum_of_products"></xsl:with-param>
<xsl:with-param name="part_number" select="$part_number"></xsl:with-param>
<xsl:with-param name="part_name" select="$part_name"></xsl:with-param>
<xsl:with-param name="part_description" select="$part_description"></xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!-- Draw rows of table-->
<xsl:template name="draw_row_for_item">
<xsl:param name="id"></xsl:param>
<xsl:param name="sum_of_products"></xsl:param>
<xsl:param name="part_number"></xsl:param>
<xsl:param name="part_name"></xsl:param>
<xsl:param name="part_description"></xsl:param>
<tr>
<xsl:variable name="rowCount">
<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>
<td rowspan="{$rowCount}" class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">
<xsl:value-of select="$part_number"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">
<xsl:value-of select="$part_name"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">
<xsl:value-of select="$part_description"></xsl:value-of>
</td>
<td rowspan="{$rowCount}" class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">
<xsl:value-of select="$sum_of_products"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id26">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/state"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id27">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/related_id/Item/manufacturer/@keyed_name"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id28">
<xsl:value-of select="Relationships/Item[@type='Part AML'][1]/related_id/Item/item_number"></xsl:value-of>
</td>
</tr>
<xsl:apply-templates select="Relationships/Item[@type='Part AML'][position()!=1]"></xsl:apply-templates>
</xsl:template>
<!--use unique id and calculate quantity for item in current chain-->
<xsl:template name="Unique">
<xsl:for-each select="//Item[@type='Part']">
<xsl:variable name="cur_id" select="@id"></xsl:variable>
<xsl:if test="not(count(descendant::Item[@type='Part' and @id=string($cur_id)]))">
<product_for_item>
<item_id>
<xsl:value-of select="$cur_id"></xsl:value-of>
</item_id>
<product>
<xsl:variable name="quantity" select="../../quantity"></xsl:variable>
<xsl:choose>
<xsl:when test="string($quantity) = ''">0</xsl:when>
<xsl:otherwise>
<xsl:apply-templates mode="product_of_quantity" select="../..">
<xsl:with-param name="product_of_chain" select="$quantity"></xsl:with-param>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</product>
</product_for_item>
</xsl:if>
</xsl:for-each>
</xsl:template>
<!--calculate product of quantities for item in its chain -->
<xsl:template mode="product_of_quantity" match="Item[@type='Part BOM']">
<xsl:param name="product_of_chain"></xsl:param>
<xsl:choose><!-- If current Part BOM at the top of the current chain -->
<xsl:when test="not(count(ancestor::Item[@type='Part BOM']))">
<xsl:value-of select="number($product_of_chain)"></xsl:value-of>
</xsl:when>
<xsl:otherwise><!-- Get the quantity of the next relationship Part BOM and apply recursion again for it-->
<xsl:variable name="quantity" select="../../../../quantity"></xsl:variable>
<xsl:apply-templates mode="product_of_quantity" select="../../../..">
<xsl:with-param name="product_of_chain" select="number($quantity)*number($product_of_chain)"></xsl:with-param>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="Item[@type='Part AML']">
<tr>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">
<xsl:value-of select="state"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">
<xsl:value-of select="related_id/Item/manufacturer/@keyed_name"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">
<xsl:value-of select="related_id/Item/item_number"></xsl:value-of>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
首选输出
<html xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:aras="http://www.aras-corp.com">
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-16">
</head>
<style type="text/css" userData="Global">
.cellSolid {text-align:center;border-top:1px #000000 solid;border-right:1px #000000 solid;border-bottom:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidTopRight {border-top:1px #000000 solid;border-right:1px #000000 solid;}
.cellSolidTopLeft {border-top:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidRightBottom {border-right:1px #000000 solid;border-bottom:1px #000000 solid;font-family:helvetica;font-size:8pt;}
.cellSolidBottomLeft {border-bottom:1px #000000 solid;border-left:1px #000000 solid;}
.cellSolidTop {border-top:1px #000000 solid;}
.cellSolidRight {border-right:1px #000000 solid;}
.cellSolidBottom {border-bottom:1px #000000 solid;}
.cellSolidLeft {border-left:1px #000000 solid;}
.cellDashed {border-top:1px #666666 dashed;border-right:1px #666666 dashed;border-bottom:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedTopRight {border-top:1px #666666 dashed;border-right:1px #666666 dashed;}
.cellDashedTopLeft {border-top:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedBottomRight {border-bottom:1px #666666 dashed;border-right:1px #666666 dashed;}
.cellDashedBottomLeft {border-bottom:1px #666666 dashed;border-left:1px #666666 dashed;}
.cellDashedTop {border-top:1px #666666 dashed;}
.cellDashedRight {border-right:1px #666666 dashed;}
.cellDashedBottom {border-bottom:1px #666666 dashed;}
.cellDashedLeft {border-left:1px #666666 dashed;}
.cellHeader {background-color:#CCCCCC;border-top:1px #000000 solid;border-right:1px #000000 solid;border-bottom:1px #000000 solid;padding:2px;text-align:center;text-transform:capitalize;text-align:center;font-family:helvetica;font-weight:bold;font-size:8pt;}
.cellTitle {border-top:1px #000000 solid;border-right:1px #000000 solid;border-left:1px #000000 solid;padding:2px;text-align:center;text-transform:capitalize;text-align:center;font-family:helvetica;font-weight:bold;font-size:8pt;}
table {empty-cells:show; border-collapse:collapse;}
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="100%">
<tr>
<td width="150" uniqueID="ms__id11"></td>
<td width="250" uniqueID="ms__id12"></td>
<td width="200" uniqueID="ms__id13"></td>
</tr>
<tr valign="top">
<td align="left" uniqueID="ms__id14" colspan="3"><img src="../images/Logos/CooperPowerSystems.gif" height="60"></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__id15">AML Quantity Report - 9.6 Parts Rev 1</td>
<td class="noBorder" colspan="4" style="font-family:helvetica;font-size:10pt;padding:2px;" align="right" uniqueID="ms__id16">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>
<td class="cellHeader" style="border-left:1px #666666 solid;" uniqueID="ms__id17">Part Number</td>
<td class="cellHeader" uniqueID="ms__id18">Name</td>
<td class="cellHeader" uniqueID="ms__id32">Description</td>
<td class="cellHeader" uniqueID="ms__id19">Calculated Quantity</td>
<td class="cellHeader" uniqueID="ms__id20">AML Status</td>
<td class="cellHeader" uniqueID="ms__id21">Manufacturer</td>
<td class="cellHeader" uniqueID="ms__id22">Manufacturer Part</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E000371</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">0</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 1</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id26">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id27">Speer</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id28">RK7D</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E000371</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">0</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 1</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">Ven</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">CR00T</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E000371</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">0</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 1</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">Sonic</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">ERJ</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E000371</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">0</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 1</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">Comp</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">NRCF</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E000371</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">0</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 1</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">Ya</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">RC0L</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E001163</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">82</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 2</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id26">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id27">Sonic</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id28">E2GX5</td>
</tr>
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">E001163</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">82</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">Part 2</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">0</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id29">Preliminary</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id30">Sonic</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id31">EGX5</td>
</tr>
</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><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><script src="../../javascript/PopupMenu.js"></script><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>
答案 0 :(得分:1)
我认为您的XSLT可以使用大量清理工具,但要实现所需的输出,您可以将其替换为:
<xsl:call-template name="draw_row_for_item">
<xsl:with-param name="id" select="$id"></xsl:with-param>
<xsl:with-param name="sum_of_products" select="$sum_of_products"></xsl:with-param>
<xsl:with-param name="part_number" select="$part_number"></xsl:with-param>
<xsl:with-param name="part_name" select="$part_name"></xsl:with-param>
<xsl:with-param name="part_description" select="$part_description"></xsl:with-param>
</xsl:call-template>
用这个:
<xsl:apply-templates select="Relationships/Item[@type='Part AML']">
<xsl:with-param name="sum_of_products" select="$sum_of_products"></xsl:with-param>
<xsl:with-param name="part_number" select="$part_number"></xsl:with-param>
<xsl:with-param name="part_name" select="$part_name"></xsl:with-param>
<xsl:with-param name="part_description" select="$part_description"></xsl:with-param>
</xsl:apply-templates>
将XSLT中的最后一个模板修改为:
<xsl:template match="Item[@type='Part AML']">
<xsl:param name="sum_of_products"></xsl:param>
<xsl:param name="part_number"></xsl:param>
<xsl:param name="part_name"></xsl:param>
<xsl:param name="part_description"></xsl:param>
<xsl:variable name="nonFirstShift" select="3 * (position() != 1)" />
<tr>
<td class="cellSolidRightBottom" width="12%" style="border-left:1px #666666 solid;" align="center" uniqueID="ms__id23">
<xsl:value-of select="$part_number"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">
<xsl:value-of select="$part_name"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="24%" align="center" uniqueID="ms__id24">
<xsl:value-of select="$part_description"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id25">
<xsl:value-of select="$sum_of_products"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="12%" align="center" uniqueID="ms__id{26 + $nonFirstShift}">
<xsl:value-of select="state"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id{27 + $nonFirstShift}">
<xsl:value-of select="related_id/Item/manufacturer/@keyed_name"></xsl:value-of>
</td>
<td class="cellSolidRightBottom" width="20%" align="center" uniqueID="ms__id{28 + $nonFirstShift}">
<xsl:value-of select="related_id/Item/item_number"></xsl:value-of>
</td>
</tr>
</xsl:template>
然后您可以删除draw_row_for_item
模板。