473,394 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Combining values in xslt

1
Hi there,
I am pretty new to XML and XSLT concepts. I am working on a project which uses a XML file to retrieve values and display them. The concept of XML file is like,

Expand|Select|Wrap|Line Numbers
  1. <root>
  2.     <customer>
        <id></id>
  3.     <name></name>
  4.     <number></number>
  5.     <day></day>
  6.     <month></month>
  7.     <year></year>    </customer>
  8. </root>
  9. <!-- Editor’s note: the <customer> tags don’t make sense this way,
  10. but I left the code as it is  -->
  11. <!-- Ceviz: corrected the mistypnig -->
  12.  
Now, as you see i have seperated the date variables as day, month and year. Because, i have asked to prepare 3 pages like
1.customers who visited today.
2.customers who visited this week.
3.customer who visited within this year.

my instincts says i need to get the date of this day and compare with dd.mm.yy and if it checks i have to display the values etc..:)
so, is there any way to achive it? If yes, then how?

Thanks in advance
May 15 '10 #1
1 1458
jkmyoung
2,057 Expert 2GB
Day, month, year comparison in xslt are always horrible. If you can, I would pass in 2 sets of parameters to the xslt.
1. Today's date.
2. Date from 6 days ago

You can easily get last year's date from today's date. The reason I suggest 2 seperately, is because of the possible month/year regrouping.

Comparing dates: start <=? date
(date.year > start.year) ||
(date.year == start.year && date.month > start.month) ||
(date.year == start.year && date.month == start.month && date.day >= start.day)

So, it's a really ugly expression.
May 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jarle Presttun | last post by:
Hi, Sometimes I display values by combining information from different sections in the xml, like I do with gradeText in the student template bellow. Is it possible to sort on gradeText when I...
8
by: mikea_59 | last post by:
I am having trouble combining similar elements. Elements can be combined if they have the same name and the same attribute values. I can handle single level elements but am having problems with...
12
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA...
6
by: Smythe32 | last post by:
I have data that looks like the following: field1 field2 123456 0,2,4,6 234567 1,2,3 345678 (if there are no values in field2, it is implied that they are 0-9) What I am trying to do is...
4
by: badbetty | last post by:
MS Access 97 query: Given 2 simple tables Person PersonRef (text) (primary key) Surname (text) e.g PersonRef Surname
3
by: Peter Row | last post by:
Hi, I have 2 XML files and 1 XSLT file. The second XML file has the following declarative 1st line: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> ....the 1st one (the one to be...
2
by: Stefan | last post by:
Hi there! I'm very new to XML and XSLT, so while working i encountered the following, probably very easy to solve, problem. i've got 2 XML-files, which look like this: LinesOfCode.xml:...
7
by: HP17 | last post by:
I’m able using Javascript to transform a XML file using XSLT to a nice HTML output. What I need to do now is to combine two XML files and transform them together using XSLT. Here an abstract example:...
7
by: C.W.Holeman II | last post by:
For info on the context of my question see the end of this posting. From http://www.w3.org/TR/XHTMLplusMathMLplusSVG/: How can I validate the result of client-side XSLT transform which has...
7
by: imani_technology_spam | last post by:
I need to do something that goes against normalization, but it is what the client wants. Let's say one person has several addresses. I need to be able to take each of those addresses and combine...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.