|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Schedule Listing with XSL (For Pros Only)
I have an XML document with a bunch of dates that I want to output chronologically. I need the days in the month that DON'T have an equivalent XML node (i.e. Empty) to still output something the likes of "FREE DAY".
In any normal programming language I'd begin with a loop for ($x = 1; $x < 31; $x++) and go through the xml doc day by day and either output the xml data if there is some for that day or output "FREE DAY" if not. ...But XSLT likes to do these kind of things completely different... How? Any push in the right direction is appreciated! |
|
#2
|
|||
|
|||
|
XSLT doesn't have any built-in functions for handling dates. You may be able to extract the day from an element. If the days are in a separate element, it wouldn't be a problem.
If you give us some of your code, we could help you further. |
|
#3
|
|||
|
|||
|
My problem isn't date-specific in that it requires date functions. I realize that XSLT without any extensions is quite limited.
I'm trying to make a list of elements by not only iterating over the nodes in the xml document, but also nodes that *might not* be there. In my specific case it means "days in a calendar" Say I've got XML code like this: Code:
<calendar> <day dayofmonth="1">work</day> <day dayofmonth="2">gym</day> <day dayofmonth="4">more work</day> </calendar> I want to spit out a list with the whole week like this: 1. work 2. gym 3. FREE TIME 4. more work There is no node with dayofmonth="3", yet, I want it to output FREE TIME if that is the case. XSLT, by its very nature doesn't seem to be able to do that. I hope I'm wrong. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Schedule Listing with XSL (For Pros Only) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|