[xsl] Works in firefox but not in ie6

Subject: [xsl] Works in firefox but not in ie6
From: "Marzka, Jeremy" <JMarzka@xxxxxxxxxx>
Date: Mon, 6 Jun 2005 16:05:38 -0400
I have the following translation that works in firefox but not in ie6. I
think the problem has to do with translate but not sure why.
 
item_avail_test.xsl
 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:xhtml="http://www.w3.org/1999/xhtml";>
 
<xsl:output method="html" indent="yes" encoding="utf-8"
omit-xml-declaration="yes"
 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; />
 
<xsl:variable name="ship_date" select="'2005-05-20'" />
 
<xsl:key name="item_avail_date"
match="result[(normalize-space(from/text()) = 'rcpts' or
normalize-space(from/text()) = 'job')]" use="date" />
<xsl:key name="item_avail_all" match="result" use="date" />
 
<xsl:template match="/">
 <html>
     <head><title>Mexico Item Avail</title></head>
  <body>
   <h3>Item: <xsl:value-of
select="/kaydon_query_item/result[1]/item/text()" /></h3>
   <h3>Ship Date: <xsl:value-of select="$ship_date" /></h3>
 
   <table border="1" width="400">
    <tr><td><strong>Ship
Date</strong></td><td><strong>Recipt</strong></td><td><strong>Available
To Ship</strong></td></tr>
    <xsl:call-template name="process_item" />
          </table>
  </body>
 </html>
</xsl:template>
 

<xsl:template name="process_item">
 
 <!-- Calculate the number of positive atp_qty sums before the ship date
-->
 <xsl:variable name="preceding_positive"
select="count(/kaydon_query_item/result
  [translate(date,'-','') &lt; translate($ship_date,'-','')]
  [(sum(preceding-sibling::result/atp_qty) + sum(key('item_avail_all',
date)/atp_qty)) &gt;= 0])" />
 
 <!-- Calculate the total number of atp_qty sums before the ship date
-->
 <xsl:variable name="preceding" select="count(/kaydon_query_item/result
  [translate(date,'-','') &lt; translate($ship_date,'-','')])" />
 
 <xsl:choose>
  <!-- If all the atp_qty sums are positive -->
  <xsl:when test="$preceding_positive = $preceding">
   <!-- Start with the first atp_qty sum -->
   <xsl:call-template name="display">
    <xsl:with-param name="start"
select="/kaydon_query_item/result[1]/date" />
   </xsl:call-template>
  </xsl:when>
 
  <!-- If there was a negative atp_qty sum -->
  <xsl:otherwise>
         <!-- Go back to the first atp_qty sum that was negative and
start from there -->
         <xsl:for-each select="/kaydon_query_item/result
    [translate(date,'-','') &lt; translate($ship_date,'-','')]
    [(sum(preceding-sibling::result/atp_qty) + sum(key('item_avail_all',
date)/atp_qty)) &lt; 0]">
 
    <!-- Start from the last negative atp_qty sum -->
    <xsl:if test="position() = last()">
     <xsl:variable name="date" select="date" />
 
     <!-- Get the first positive atp_qty sum after the last negative -->
     <xsl:variable name="start"
select="/kaydon_query_item/result[translate(date,'-','')
      &gt; translate($date,'-','')]/date" />
 
     <xsl:call-template name="display">
      <xsl:with-param name="start" select="$start" />
     </xsl:call-template>
    </xsl:if>
 
         </xsl:for-each>
  </xsl:otherwise>
 </xsl:choose>
 
</xsl:template>
 
<!-- Display the item availabilty in a table -->
<xsl:template name="display">
<xsl:param name="start" select="$ship_date" />
 
 <xsl:for-each select="/kaydon_query_item/result
  [generate-id() = generate-id(key('item_avail_date', date))]
  [translate(date,'-','') &gt;= translate($start,'-','')]">
 
  <xsl:variable name="date" select="date" />
 
  <xsl:variable name="recipt"
select="sum(/kaydon_query_item/result[translate(date,'-','')
   = translate($date,'-','')]/rcpt_qty)" />
 
  <xsl:variable name="sum_atp_qty"
select="sum(/kaydon_query_item/result[translate(date,'-','') 
   &lt;= translate($date,'-','')]/atp_qty)" />
 
  <xsl:variable name="total_atp_qty"
select="sum(/kaydon_query_item/result/atp_qty)" />
 
  <xsl:if test="$sum_atp_qty &gt; 0">
   <tr>
   <td><xsl:value-of select="$date" /></td>
   <td><xsl:value-of select="$recipt" /></td>
   <td>
    <xsl:choose>
 
     <xsl:when test="position() = last()">
      <xsl:value-of select="$total_atp_qty" />
     </xsl:when>
     <xsl:otherwise>
      <xsl:value-of select="$sum_atp_qty" />
     </xsl:otherwise>
    </xsl:choose>
   </td>
   </tr>
  </xsl:if>
 
 </xsl:for-each>
</xsl:template>
 

</xsl:stylesheet>
 
item_avail_test.xml:
<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type="text/xsl" href="item_avail_test.xsl"?>
<kaydon_query_item>
<result>
<from>
itemloc </from>
<item>
14143001</item>
<date>
2001-01-08</date>
<on_hand>
4</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
4</atp_qty>
</result>
<result>
<from>
job </from>
<item>
14143001</item>
<date>
2005-04-11</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
6</rcpt_qty>
<atp_qty>
6</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-04-11</date>
<on_hand>
0</on_hand>
<req_qty>
8</req_qty>
<rcpt_qty>
6</rcpt_qty>
<atp_qty>
-2</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-04-25</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
0</atp_qty>
</result>
<result>
<from>
job </from>
<item>
14143001</item>
<date>
2005-05-16</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-05-16</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
0</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-05-23</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-05-23</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-05-23</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-05-23</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-05-30</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-05-30</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-06-13</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-06-13</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-06-27</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-06-27</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-07-04</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-07-04</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-07-11</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-07-11</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-07-18</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-07-18</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-07-25</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-07-25</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-08-08</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-08-08</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-08-15</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-08-15</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-08-22</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-08-22</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-08-29</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-08-29</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2005-09-05</date>
<on_hand>
0</on_hand>
<req_qty>
30</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-30</atp_qty>
</result>
<result>
<from>
rcpts </from>
<item>
14143001</item>
<date>
2005-09-05</date>
<on_hand>
0</on_hand>
<req_qty>
0</req_qty>
<rcpt_qty>
30</rcpt_qty>
<atp_qty>
30</atp_qty>
</result>
<result>
<from>
mrp </from>
<item>
14143001</item>
<date>
2006-01-02</date>
<on_hand>
0</on_hand>
<req_qty>
1</req_qty>
<rcpt_qty>
0</rcpt_qty>
<atp_qty>
-1</atp_qty>
</result>
</kaydon_query_item>
 
Any idea what needs to be changed?
 
Thanks
Jeremy

Current Thread