Quantcast
Channel: aras PLM community
Viewing all articles
Browse latest Browse all 1103

Calling Javascript within XSLT

$
0
0

I am trying to reformat a XML date value to dd-MMM-yy (18-Nov-15) in a report. I am having trouble figuring out how to run the javascript within the XSLT to have the report I am creating show 27-Aug-15 instead of its original output 2015-08-27T00:00:00

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:user-scripts" xmlns:aras="http://www.aras-corp.com">
  <xsl:output method="html" omit-xml-declaration="yes" standalone="yes" indent="yes"/>
  <xsl:template match="/">
    <html>
      <head>
       <title>
     Action Item Report: <xsl:value-of select="jav_action_id"/>
    </title>
      </head>
      <style type="text/css" userData="Global">
    .cellSolid {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;}
    .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;}
   </style>
   <script type="text/javascript">
    function mydateformat(datein){
    var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
    var d = new Date(datein);
    var curr_date = d.getDate();
    var curr_month = d.getMonth();
    var curr_year = d.getFullYear().toString().substr(2,2);
    return curr_date + "-" + m_names[curr_month] + "-" + curr_year;
    }
   </script>
      <script>
    onload = function() {window.resizeTo(1050,650);}
   </script>
      <body topmargin="50" leftmargin="50">
        <table border="0" cellspacing="0" cellpadding="0" width="1000">
          <tr>
            <td width="120"/>
            <td width="200"/>
            <td width="50"/>
            <td width="50"/>
            <td width="100"/>
            <td width="100"/>
            <td width="100"/>
            <td width="120"/>
        <td width="120"/>
        <td width="75"/>
          </tr>
          <tr valign="top">
            <td align="right" uniqueID="ms__id77" colspan="9">
              <img src="../images/seaspan_logo.png" width="150px"/>
            </td>
          </tr>
          <tr valign="bottom">
            <td colspan="6" style="font-family:helvetica;font-size:15pt;color:#DA1943;padding:2px;" align="left" uniqueID="ms__id79">Action Items Need vs. Forecast Date</td>
            <td colspan="2" style="font-family:helvetica;font-size:10pt;padding:2px;" align="right" uniqueID="ms__id80">
       Generated on: <script>
        var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
        var d = new Date();
        var curr_date = d.getDate();
        var curr_month = d.getMonth();
        var curr_year = d.getFullYear().toString().substr(2,2);
        document.write(curr_date + "-" + m_names[curr_month]
       + "-" + curr_year);</script>
      </td>
          </tr>
             <tr valign="top">
               <td class="cellHeader" uniqueID="ms__id81" align="left" colspan="" rowspan="" height="" width="" style="border-left:1px #666666 solid;">Action Item No</td>
               <td class="cellHeader" uniqueID="ms__id82">Title</td>
               <td class="cellHeader" uniqueID="ms__id84">Priority</td>
               <td class="cellHeader" uniqueID="ms__id84">Project</td>
               <td class="cellHeader" uniqueID="ms__id84">Comm. Sensitive</td>
               <td class="cellHeader" uniqueID="ms__id83">Approver</td>
               <td class="cellHeader" uniqueID="ms__id85">Owner</td>
               <td class="cellHeader" uniqueID="ms__id86">Need Date</td>
       <td class="cellHeader" uniqueID="ms__id87">Forecast Date</td>
       <td class="cellHeader" uniqueID="ms__id88">Status</td>
             </tr>
             <xsl:for-each select="//Item">
               <xsl:sort select="jav_action_id" order="ascending" case-order="upper-first" data-type="text"/>
       <xsl:sort select="jav_com_sen" order="ascending" case-order="upper-first" data-type="text"/>
               <tr valign="center">
                 <td style="font-family:helvetica;font-size:8pt;font-weight:bold;border-left:1px #666666 solid;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id90" colspan="" rowspan="" height="" width="">
                   <xsl:value-of select="jav_action_id"/>
                   <xsl:if test="jav_action_id='' or not(jav_action_id)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id91">
                   <xsl:value-of select="jav_title"/>
                   <xsl:if test="jav_title='' or not(jav_title)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id93">
                   <xsl:value-of select="jav_priority"/>
                   <xsl:if test="jav_priority='' or not(jav_priority)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id94">
                   <xsl:value-of select="jav_project"/>
                   <xsl:if test="jav_project='' or not(jav_project)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id95">
                   <xsl:value-of select="jav_com_sen"/>
                   <xsl:if test="jav_com_sen='' or not(jav_com_sen)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id96">
                   <xsl:value-of select="managed_by_id/@keyed_name"/>
                   <xsl:if test="managed_by_id/@keyed_name='' or not(managed_by_id/@keyed_name)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id97">
                   <xsl:value-of select="owned_by_id/@keyed_name"/>
                   <xsl:if test="owned_by_id/@keyed_name='' or not(owned_by_id/@keyed_name)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
                 <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id97">
                   <xsl:value-of select="jav_due_date"/>
                   <xsl:if test="jav_due_date='' or not(jav_due_date)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
           <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id97">
                   <xsl:value-of select="jav_clos_due_date"/>
                   <xsl:if test="jav_clos_due_date='' or not(jav_clos_due_date)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
        
         <td style="font-family:helvetica;font-size:8pt;padding:2px;" class="cellSolidRightBottom" align="left" uniqueID="ms__id100">
                   <xsl:value-of select="state"/>
                   <xsl:if test="state='' or not(state)">
                     <xsl:text>&#160;</xsl:text>
                   </xsl:if>
                 </td>
               </tr>
             </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

 


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>