Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2009, 05:22 PM
Authorized User
 
Join Date: Jun 2008
Posts: 17
Thanks: 2
Thanked 0 Times in 0 Posts
Default Revome weekend data

I have an very special request, in the following sample xml, data03 is sales data for Dec 2008, data04 is sales data for Jan 2009.

The request is filter out weekend data. As you can see, I can't just filter out record by record. Since day="01" is Monday in Dec 2008, Tuesday in Jan 2009, and Sunday in Feb 2009.

I am using XSLT 1.0, any idea are highly appreciated!

<?xml version="1.0"?>
<result>
<chartheader header03=" Dec 2008" header04=" Jan 2009" header05=" Feb 2009"/>
<chartdata>
<row day="01" data03="10" data04="10" data05="10"/>
<row day="02" data03="11" data04="11" data05="11"/>
<row day="03" data03="12" data04="12" data05="12"/>
<row day="04" data03="13" data04="13" data05="13"/>
<row day="05" data03="14" data04="14" data05="14"/>
<row day="06" data03="15" data04="15" data05="15"/>
<row day="07" data03="16" data04="16" data05="16"/>
<row day="08" data03="17" data04="17" data05="17"/>
<row day="09" data03="18" data04="18" data05="18"/>
<row day="10" data03="19" data04="19" data05="19"/>
<row day="11" data03="20" data04="20" data05="20"/>
<row day="12" data03="21" data04="21" data05="21"/>
<row day="13" data03="22" data04="22" data05="22"/>
<row day="14" data03="23" data04="23" data05="23"/>
<row day="15" data03="24" data04="24" data05="24"/>
<row day="16" data03="25" data04="25" data05="25"/>
<row day="17" data03="26" data04="26" data05="26"/>
<row day="18" data03="27" data04="27" data05="27"/>
<row day="19" data03="28" data04="28" data05="28"/>
<row day="20" data03="29" data04="29" data05="29"/>
<row day="21" data03="30" data04="30" data05="30"/>
<row day="22" data03="31" data04="31" data05="31"/>
<row day="23" data03="32" data04="32" data05="32"/>
<row day="24" data03="33" data04="33" data05="33"/>
<row day="25" data03="34" data04="34" data05="34"/>
<row day="26" data03="35" data04="35" data05="35"/>
<row day="27" data03="36" data04="36" data05="36"/>
<row day="28" data03="37" data04="37" data05="37"/>
<row day="29" data03="38" data04="38" data05=""/>
<row day="30" data03="39" data04="39" data05=""/>
<row day="31" data03="40" data04="40" data05=""/>
</chartdata>
</result>

Thanks a lot!
__________________
George Meng
 
Old February 5th, 2009, 06:05 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you are using XSLT 2.0, first construct an xs:date value (YYYY-MM-DD) by string-manipulation, then use format-date($date, '[F1]', (), 'ISO', ()) to get the day of the week (1=Monday, 7=Sunday).

With XSLT 1.0, you could look at the EXSLT date and time handling library.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
DateDiff excluding weekend days ghall202 Access VBA 1 March 3rd, 2008 09:48 AM
Data Binding - Editing GridView Row Data desk_star BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 7 December 30th, 2007 11:07 AM
Need answer by this weekend if possible Michele_Haywood Access VBA 5 November 22nd, 2006 05:57 AM
Need help by this weekend Help-Help-Help Michele_Haywood Access VBA 0 October 27th, 2006 11:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.