Hi All

Ive got an XSL for some XML data. The XML data contains a date field called OrderNum_OrderDate.

How can I filter the data so it only displays data from the XML that has a date of TODAY + 7 days.

I only want to see information for the next seven days.

It needs to be based on a dynamic date so it doesnt have to be changed every day.

Any help would be appreciated.

Thanks.

XSLT 1.0 or 2.0 ? Please post a small sample of your XML input document and how you want the data to look like on the output. USE CODEBOXES.

Thanks for the prompt reply.

Im totally new to all of this so what may be easy for you is not for me :-)

This is the first entry in my XML for the 'PARENT'.

<?xml version="1.0" encoding="utf-8"?>
<ExportQuery>
  <ELEC01_SalesOrdersWaitingParts>
    <Customer_CustID><![CDATA[V027]]></Customer_CustID>
    <OrderHed_RequestDate><![CDATA[01/02/11]]></OrderHed_RequestDate>
    <OrderHed_OrderDate><![CDATA[24/02/11]]></OrderHed_OrderDate>
    <OrderHed_NeedByDate><![CDATA[07/03/11]]></OrderHed_NeedByDate>
    <OrderHed_OrderNum><![CDATA[19122]]></OrderHed_OrderNum>
    <OrderHed_OpenOrder><![CDATA[Open]]></OrderHed_OpenOrder>
    <OrderDtl_OrderNum><![CDATA[19122]]></OrderDtl_OrderNum>
    <OrderDtl_OrderLine><![CDATA[1]]></OrderDtl_OrderLine>
    <OrderDtl_OrderQty><![CDATA[10.00]]></OrderDtl_OrderQty>
    <OrderDtl_PartNum><![CDATA[S17 150-150]]></OrderDtl_PartNum>
    <Part_PartNum><![CDATA[S17 150-150]]></Part_PartNum>
    <TotalOnHandQty><![CDATA[1.00]]></TotalOnHandQty>
    <TotalDemandQty><![CDATA[35.00]]></TotalDemandQty>
    <OnHandDemandLine><![CDATA[-24.00]]></OnHandDemandLine>
    <JobHead_PartNum><![CDATA[S17 150-150]]></JobHead_PartNum>
    <JobHead_JobNum><![CDATA[018816]]></JobHead_JobNum>
    <JobHead_JobComplete><![CDATA[No]]></JobHead_JobComplete>
    <JobOper_JobNum><![CDATA[018816]]></JobOper_JobNum>
    <JobOper_OpCode><![CDATA[INSP PR6]]></JobOper_OpCode>
    <JobOper_OpDesc><![CDATA[INSP FOLD PR6]]></JobOper_OpDesc>
    <JobOper_OpComplete><![CDATA[No]]></JobOper_OpComplete>
    <JobOper_QtyCompleted><![CDATA[0.00]]></JobOper_QtyCompleted>
    <NotEnoughStock><![CDATA[TRUE]]></NotEnoughStock>
    <JobMtl_JobNum><![CDATA[018816]]></JobMtl_JobNum>
    <JobMtl_PartNum><![CDATA[1.4301 2J PC1 1500 X 1250 X 1.2]]></JobMtl_PartNum>
    <JobMtl_RequiredQty><![CDATA[0.86]]></JobMtl_RequiredQty>
  </ELEC01_SalesOrdersWaitingParts>

This is my code for my XSL and this is where I need it to filter on the OrderHed.RequestDate.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes"/>

<xsl:template match="/">
  <html>
  <body bgcolor="white">
Orders to be shipped before TODAY + 7 days
    <table cellpadding="4px">
      <tr>
	<td align="center"><B1>Customer</B1></td>
        <td align="center"><B1>Order No.</B1></td>
        <td align="center"><B1>Order Date</B1></td>
        <td align="center"><B1>Ship By</B1></td>
        <td><B1>Part Required</B1></td>
        <td align="right"><B1>Req Qty</B1></td>
	<td align="right"><B1>O/H</B1></td>
        <td align="right"><B1>Dem.</B1></td>
        <td align="center"><B1>Job</B1></td>
        <td><B1>Stage</B1></td>
        <td align="right"><B1>Complete</B1></td>
	<td align="center"><B1>Status</B1></td>
      </tr>
      <xsl:for-each select="ExportQuery/ELEC01_SalesOrdersWaitingParts[NotEnoughStock='TRUE']">

	<xsl:if test="position()  mod 2 = 1">

      	<tr bgcolor="#CCCCCC">

	<td align="center"><B2><xsl:value-of select="Customer_CustID"/></B2></td>
        <td align="center"><xsl:value-of select="OrderHed_OrderNum"/></td>
      	<td align="center"><xsl:value-of select="OrderHed_OrderDate"/></td>
      	<td align="center"><xsl:value-of select="OrderHed_RequestDate"/></td>
      	<td><xsl:value-of select="Part_PartNum"/></td>
      	<td align="right"><xsl:value-of select="OrderDtl_OrderQty"/></td>
      	<td align="right"><xsl:value-of select="TotalOnHandQty"/></td>
      	<td align="right"><xsl:value-of select="TotalDemandQty"/></td>
      	<td align="center"><xsl:value-of select="JobHead_JobNum"/></td>
      	<td><xsl:value-of select="JobOper_OpDesc"/></td>
      	<td align="right"><xsl:value-of select="JobOper_QtyCompleted"/></td>

   	</tr>
	</xsl:if>


	<xsl:if test="position()  mod 2 = 0">

      	<tr bgcolor="#FFFFFF">

	<td align="center"><B2><xsl:value-of select="Customer_CustID"/></B2></td>
        <td align="center"><xsl:value-of select="OrderHed_OrderNum"/></td>
      	<td align="center"><xsl:value-of select="OrderHed_OrderDate"/></td>
      	<td align="center"><xsl:value-of select="OrderHed_RequestDate"/></td>
      	<td><xsl:value-of select="Part_PartNum"/></td>
      	<td align="right"><xsl:value-of select="OrderDtl_OrderQty"/></td>
      	<td align="right"><xsl:value-of select="TotalOnHandQty"/></td>
      	<td align="right"><xsl:value-of select="TotalDemandQty"/></td>
      	<td align="center"><xsl:value-of select="JobHead_JobNum"/></td>
      	<td><xsl:value-of select="JobOper_OpDesc"/></td>
      	<td align="right"><xsl:value-of select="JobOper_QtyCompleted"/></td>

   	</tr>
	</xsl:if>



      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

I want to firstly see anything that has a OrderHed.RequestDate >= TODAY + 7 days.

I then want to be able to filter it in a separate XSL so it displays any OrderHed.RequestDate >= TODAY + 7 days BUT <= TODAY + 14 days.

Any help / suggestions would be appreciated.

Edited 5 Years Ago by chriselectrix: n/a

This article has been dead for over six months. Start a new discussion instead.