[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

XML Calculation Error

Asked by cotaej in Extensible Markup Language (XML)

I am trying to perform a calculation in one section using values from another and apparently I am not referencing them correctly.

On line of 181 of the XSL document the following returns a value of NaN:
<TH style="text-align: right"><xsl:value-of select='format-number((number(//po_total_amount) - number(//po_nimo_paid) - sum(//invoice_amount_paid))
,"$###,###,##0.00")'/>&#160;</TH>

Thanks in advance


XML DOCUMENT:
===============================================
<?xml version='1.0' ?>
<?xml-stylesheet type='text/xsl' href='invoice.xsl' ?>
<document>
      <purchase_order>
          <po_header>
                  <po_total_amount>$23,919.00</po_total_amount>
                  <po_nimo_paid>$150.00</po_nimo_paid>
          </po_header>
        </purchase_order>

      <invoices>
            <pyxis_invoice>
                  <invoice_amount_paid>500.00</invoice_amount_paid>
             </pyxis_invoice>

            <pyxis_invoice>
                  <invoice_amount_paid>600.00</invoice_amount_paid>
            </pyxis_invoice>

            <pyxis_invoice>
                  <invoice_amount_paid>800.00</invoice_amount_paid>
            </pyxis_invoice>
      </invoices>
</document>

XSL DOCUMENT:
====================================================
<?xml version='1.0' encoding='utf-8' ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" />

<xsl:template match='document'>
   <HTML>
     <HEAD>
       <TITLE>Nine Mile Point - PO Invoices</TITLE>
       <link rel='stylesheet' type='text/css' href='../../css/nucweb.css' />
       <STYLE type='text/css'>
         TH {text-align:left; vertical-align:bottom ;}
         TD {text-align:left; vertical-align:top    ;}
       </STYLE>
     </HEAD>
     <BODY>
       <FORM method='get' action='../udt/ewc_po_invoices.com'>
          Enter PO#
          <INPUT type='text'   id='po'   name='po'   size='10'></INPUT>
          <INPUT type='submit' id='btnSubmit' name='btnSubmit' value='Go'  ></INPUT>
          <HR></HR>
       </FORM>
       <xsl:apply-templates select="errors"         />
       <xsl:apply-templates select="purchase_order" />
       <xsl:apply-templates select="invoices"       />
     </BODY>
   </HTML>
</xsl:template>

<xsl:template match="purchase_order" >
       <xsl:apply-templates select='po_header' />
       <xsl:apply-templates select='po_detail' />
</xsl:template>

<xsl:template match="po_header" >
   
<table border="1" width="100%">
  <tr>
<th width="100%" height="19" style="text-align: center" bgcolor="silver"> NMP Purchase Order Information </th>
</tr>
</table>

<table border="1" width="100%">
 
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">PO Number</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_number'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Order Date</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_order_date'/>&#160;</td>
  </tr>
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Amount</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_total_amount'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Expire Date</td>
    <td width="25%" style="text-align: center"><xsl:value-of select='po_expire_date'/>&#160;</td>
  </tr>

  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Status</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_status'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">NIMO Paid</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_nimo_paid'/>&#160;</td>
  </tr>

  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Type</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_type'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Payment Terms</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_terms'/>&#160;</td>
  </tr>

  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Buyer</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='buyer_name'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Freight Terms</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='ship_via'/>&#160;</td>
  </tr>

  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Vendor</td>
    <td width="25%"><xsl:value-of select='vendor_number'/>&#160;</td>
    <td width="50%" colspan="2"><xsl:value-of select='vendor_name'/>&#160;</td>
  </tr>
</table>

<table border="1" width="100%">
  <tr>
    <td width="100%" height="19" style="text-align: left" bgcolor="#00FFFF">Description</td>
  </tr>
  <tr>
    <td width="100%" style="text-align: left; vertical-align: top"><xsl:value-of select='po_description'/>&#160;
</td>
  </tr>
</table>
</xsl:template>

<xsl:template match="po_detail" >
       <xsl:apply-templates select='po_line' />

</xsl:template>

<xsl:template match="po_line" >

 <table border="1" width="100%">
  <tr>
    <th width="100%" style="text-align: center" bgcolor="silver">NMP Detail Information</th>
  </tr>
 
</table>

<table border="1" width="100%">
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Requisition</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_req_number'/>&#160;</td>
    <td width="25%" style="text-align: right; vertical-align: middle" bgcolor="#00FFFF">Part Number</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_item'/>&#160;</td>

   </tr>
   <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Type</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_req_type'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Requested Quantity</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_qty'/>&#160;</td>
    </tr>
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Approver Number</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_approver_number'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Received Quantity</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='item_rcvd_qty'/>&#160;</td>
  </tr>
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Approver Limit</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_approver_amount'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Unit Price</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_unit_price'/>&#160;</td>
  </tr>
</table>
<table border="1" width="100%">
  <tr>
    <td width="25%" style="text-align: left" bgcolor="#00FFFF">Approver Name</td>
    <td width="25%" style="text-align: left"><xsl:value-of select='po_approver_name'/>&#160;</td>
    <td width="25%" style="text-align: right" bgcolor="#00FFFF">Extended Value</td>
    <td width="25%" style="text-align: right"><xsl:value-of select='po_extended_price'/>&#160;</td>
  </tr>
</table>
 <xsl:apply-templates select='po_wbs_numbers' />
</xsl:template>

<xsl:template match='po_wbs_numbers'>
  <xsl:for-each select='po_wbs_number'>
    <table border="1" width="100%">
      <tr>
        <td width="25%" style="text-align: left; vertical-align: middle" bgcolor="#00FFFF">WBS Number</td>
        <td width="75%" style="text-align: left"><xsl:value-of select='.'/>&#160;</td>
      </tr>
    </table>
  </xsl:for-each>
</xsl:template>

<xsl:template match='errors'>
   <xsl:apply-templates select='error' />
</xsl:template>

<xsl:template match='error'>
   <font color='red'>ERROR:  </font>
   <xsl:value-of select='app_name'    />
   <br />
   <xsl:value-of select='error_message'    />
</xsl:template>


<xsl:template match='invoices'>
   <TABLE border='1'>
     <TR><TH colspan='7'  bgcolor="silver">Invoice Information From Pyxis</TH></TR>
     <TR >
        <TH style="text-align: right">&#160;</TH>
        <TH style="text-align: right">&#160;</TH>
        <TH style="text-align: right">Totals</TH>
        <TH style="text-align: right"><xsl:value-of select='format-number(sum(//invoice_amount),"$###,###,##0.00")'     />&#160;</TH>
        <TH style="text-align: right"><xsl:value-of select='format-number(sum(//invoice_amount_paid),"$###,###,##0.00")'/>&#160;</TH>
        <TH style="text-align: right">Remaining</TH>
        <TH style="text-align: right"><xsl:value-of select='format-number((number(//po_total_amount) - number(//po_nimo_paid) - sum(//invoice_amount_paid))
,"$###,###,##0.00")'/>&#160;</TH>
     </TR>
     <TR><TH bgcolor="#00FFFF">Invoice Number     </TH>
         <TH bgcolor="#00FFFF">Invoice Date       </TH>
         <TH bgcolor="#00FFFF">Invoice Rcvd       </TH>
         <TH bgcolor="#00FFFF">Invoice Amount     </TH>
         <TH bgcolor="#00FFFF">Invoice Amt Paid   </TH>
         <TH bgcolor="#00FFFF">Contact            </TH>
         <TH bgcolor="#00FFFF">Voucher #          </TH>
     </TR>
     <BR>
     <xsl:apply-templates select='pyxis_invoice' /></BR>
   </TABLE>
</xsl:template>

<xsl:template match='pyxis_invoice'>
   <TR>
     <TD              ><xsl:value-of select='invoice_number'                                         />&#160;</TD>
     <TD              ><xsl:value-of select='invoice_date'                                           />&#160;</TD>
     <TD              ><xsl:value-of select='invoice_received_date'                                  />&#160;</TD>
     <TD style="text-align: right"><xsl:value-of select='format-number(invoice_amount,      "$###,###,##0.00")'   />&#160;</TD>
     <TD style="text-align: right"><xsl:value-of select='format-number(invoice_amount_paid, "$###,###,##0.00")'   />&#160;</TD>
     <TD              ><xsl:value-of select='invoice_contact_person'                                 />&#160;</TD>
     <TD              ><xsl:value-of select='voucher_num'                                            />&#160;</TD>
    </TR>
</xsl:template>


</xsl:stylesheet>
[+][-]11/05/04 08:24 AM, ID: 12505950Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/04 08:33 AM, ID: 12506096Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/04 08:38 AM, ID: 12506160Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Extensible Markup Language (XML)
Sign Up Now!
Solution Provided By: ramazanyich
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-89