我正在尝试做与2009年提出的问题非常类似的事情 - 。不同之处在于我想更深入一级。我没有问题获取ID,poNumber等信息。我的问题是能够将会计信息提供给HTML表单。有关如何更新我的xslt样式表的任何建议?任何帮助将不胜感激。谢谢!
xml:
<?xml version = "1.0" encoding = "UTF-8"?>
<xmlString><?xml version="1.0" encoding="UTF-8"?>
<resultSet xmlns="">
<Record>
<ID>27184882</ID>
<poNumber>EP40158</poNumber>
<eventDate>Tue, 19 Nov, 2013</eventDate>
<totalCost>400</totalCost>
<LineItems>
<Item>1</Item>
<Part_Number>part456</Part_Number>
<Unit>EA</Unit>
<Quantity>20</Quantity>
<Description>3rd line</Description>
<AdditionalInfo>
<FieldName>Print Job Title or Description</FieldName>
<FieldValue>Test Print Test Print </FieldValue>
</AdditionalInfo>
<AdditionalInfo>
<FieldName>SDN Phone</FieldName>
<FieldValue>214-792-4312</FieldValue>
</AdditionalInfo>
<Accounting>
<splitQuantity>20</splitQuantity>
<costCenter>21000</costCenter>
<genLedger>5600680</genLedger>
</Accounting>
</LineItems>
<LineItems>
<Item>2</Item>
<Part_Number>part456</Part_Number>
<Unit>EA</Unit>
<Quantity>400</Quantity>
<requisitionRequester>e61140</requisitionRequester>
<AdditionalInfo>
<FieldName>Print Job Title or Description</FieldName>
<FieldValue>Line 2 Print Test</FieldValue>
</AdditionalInfo>
<Accounting>
<splitQuantity>20</splitQuantity>
<costCenter>21000</costCenter>
<genLedger>5600680</genLedger>
</Accounting>
</LineItems>
<LineItems>
<Item>3</Item>
<Part_Number>part567</Part_Number>
<Unit>EA</Unit>
<Quantity>35</Quantity>
<Description>testing</Description>
<AdditionalInfo>
<FieldName>Print Job Title or Description</FieldName>
<FieldValue>Testing</FieldValue>
</AdditionalInfo>
<AdditionalInfo>
<FieldName>SDN Phone</FieldName>
<FieldValue>214-792-4312</FieldValue>
</AdditionalInfo>
<Accounting>
<splitQuantity>20</splitQuantity>
<costCenter>21000</costCenter>
<genLedger>5600680</genLedger>
</Accounting>
</LineItems>
</Record>
</resultSet>
</xmlString>
所需的HTML输出:
Item Part Number Unit Quantity Description Need By Unit Price Extended Amount
1 part456 EA 20 3rd line Wed, 01 Jan, 2014 10 200
Additional Information
Field Name Field Value
Print Job Title or Description Test Print Test Print
Field Name Field Value
SDN Phone 214-792-4312
Item Part Number Unit Quantity Description Need By Unit Price Extended Amount
2 part456 EA 400 4th line Sun, 12 Jan, 2014 10 4000
Additional Information
Field Name Field Value
Print Job Title or Description Line 2 Print Test
Item Part Number Unit Quantity Description Need By Unit Price Extended Amount
3 part567 EA 35 testing Sat, 11 Jan, 2014 1166.7 3500
Additional Information
Field Name Field Value
Print Job Title or Description Testing
Field Name Field Value
SDN Phone 214-792-4312
这是xslt:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Order <xsl:value-of select="/resultSet/Record/poNumber"></xsl:value-of></title>
</head>
<body>
<font face="Arial Helvetica" size = "1">
<p>
<h2>Order No. <xsl:value-of select="/resultSet/Record/poNumber"/> </h2>
Version Number: <xsl:value-of select="/resultSet/Record/Version"/><br/>
Internal Version: false<br/>
Issued on <xsl:value-of select="/resultSet/Record/eventDate"/><br/>
Created on <xsl:value-of select="/resultSet/Record/eventDate"/><br/><br/>
</p>
<p>
<table border="0" width="95%%">
<tr valign="top">
<td colspan="4">
<font size="2">
<b>Supplier:</b><br/>
<xsl:value-of select="/resultSet/Record/supplierName"/><br/>
<xsl:value-of select="/resultSet/Record/supplierStreet"/><br/>
<xsl:value-of select="/resultSet/Record/supplierCity"/>, <xsl:value-of select="/resultSet/Record/supplierState"/>
<xsl:value-of select="/resultSet/Record/supplierZipcode"/><br/>
<xsl:value-of select="/resultSet/Record/supplierCountry"/><br/>
Phone: 1 <br/>
Fax: 1 <br/>
Contact: <xsl:value-of select="/resultSet/Record/supplierContact"/><br/>
</font>
</td>
</tr>
</table>
</p>
<p>
<table border="0" width="95%%">
<tr valign="top">
<td colspan="4">
<font size="2">
<b>Bill To:</b><br/>
<xsl:value-of select="/resultSet/Record/billtoName"/><br/>
<xsl:value-of select="/resultSet/Record/billtoStreet"/><br/>
<xsl:value-of select="/resultSet/Record/billtoCity"/>, <xsl:value-of select="/resultSet/Record/billtoState"/> <xsl:value-of select="/resultSet/Record/billtoZipcode"/><br/>
<xsl:value-of select="/resultSet/Record/billtoCountry"/><br/>
<xsl:value-of select="/resultSet/Record/billtoPhone"/><br/>
</font>
</td>
</tr>
</table>
</p>
<p>
<table border="0" width="95%%">
<tr valign="top">
<td colspan="4">
<font size="2">
<b>Ship To:</b><br/>
<xsl:value-of select="/resultSet/Record/shiptoName"/><br/>
<xsl:value-of select="/resultSet/Record/shiptoStreet"/><br/>
<xsl:value-of select="/resultSet/Record/shiptoCity"/>, <xsl:value-of select="/resultSet/Record/billtoState"/> <xsl:value-of select="/resultSet/Record/shiptoZipcode"/><br/>
<xsl:value-of select="/resultSet/Record/shiptoCountry"/><br/>
<xsl:value-of select="/resultSet/Record/shiptoPhone"/><br/>
<br/>
<b>Deliver To: </b>
<xsl:value-of select="/resultSet/Record/deliverTo"/><br/>
<xsl:value-of select="/resultSet/Record/shippingAddress"/><br/>
</font>
</td>
</tr>
</table>
</p>
<p>
<table border="0" width="95%%">
<tr valign="top">
<td>
<font size="2">
<b>Additional Information: </b>
<p>
Terms and Conditions: This purchase subject to the attached Southwest Airlines Terms and Conditions.
</p>
</font>
</td>
</tr>
</table>
</p>
<br/>
<br/>
<p>
<table border="1" width="95%%">
<xsl:for-each select="/resultSet/Record/LineItems">
<tr valign="top">
<th>Item</th>
<th>Part Number</th>
<th>Unit</th>
<th>Quantity</th>
<th>Description</th>
<th>Need By</th>
<th>Unit Price</th>
<th>Extended Amount</th>
</tr>
<td><xsl:apply-templates select="Item"/></td>
<td><xsl:apply-templates select="Part_Number"/></td>
<td><xsl:apply-templates select="Unit"/></td>
<td><xsl:apply-templates select="Quantity"/></td>
<td><xsl:apply-templates select="Description"/></td>
<td><xsl:apply-templates select="Need_By"/></td>
<td><xsl:apply-templates select="Unit_Price"/></td>
<td><xsl:apply-templates select="Extended_Amount"/></td>
<tr valign="top">
<th>Additional Information</th>
</tr>
<xsl:for-each select="./AdditionalInfo">
<tr valign="top">
<th>Field Name</th>
<th>Field Value</th>
</tr>
<td><xsl:apply-templates select="FieldName"/></td>
<td><xsl:apply-templates select="FieldValue"/></td>
</xsl:for-each>
<xsl:for-each select="./LineItems/Accounting">
<tr valign="top">
<td></td>
<td colspan="8"> <font size="2">
Requester: <xsl:apply-templates select="requisitionRequester"/><br/>
PR No.: <xsl:apply-templates select="requisitionID"/><br/>
</font></td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</p>
</font>
</body>
</html>