Guest User

Untitled

a guest
Jul 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. I have an rss feed of the format:
  2.  
  3. <rss>
  4. <tvshow id="17279" day="1" start="600" end="720" duration="120">
  5. <description> show 1 is about.. </description>
  6. </tvshow>
  7. <tvshow id="17280" day="1" start="800" end="920" duration="120">
  8. <description> show 1 is about.. </description>
  9. </tvshow>
  10. <tvshow id="17283" day="1" start="1000" end="1120" duration="120">
  11. <description> show 1 is about.. </description>
  12. </tvshow>
  13. <tvshow id="17289" day="1" start="1500" end="1620" duration="120">
  14. <description> show 1 is about.. </description>
  15. </tvshow>
  16. <tvshow id="17281" day="2" start="600" end="720" duration="120">
  17. <description> show 1 is about.. </description>
  18. </tvshow>
  19. <tvshow id="17282" day="3" start="600" end="720" duration="120">
  20. <description> show 1 is about.. </description>
  21. </tvshow>
  22. </rss>
  23.  
  24. I am aiming to have my XSL to get the current Time (ie xslt2
  25. currentTime). I want to compare this time to see if it falls within
  26. the interval of each of the show on a specific day (ie day 1). If it
  27. falls within that timeslot, then I want to grab the description tag.
  28. However, if the currentTime is within 30 minutes of the next show, I
  29. want the description to update within that 30 minute interval.
  30.  
  31. I can't think out the proper way to do this in XSL. I can store a
  32. currentTime and then take the difference of the currentTime and the
  33. start time, and then compare the minimums. This is easy to say but
  34. how do I code this in xsl?
  35.  
  36. Can I do something a recursive look to find the minimum difference (ie
  37. current show?)
  38.  
  39. example:
  40.  
  41. <xsl:if test="min(currentTime-/rss/tvshow/@start)"/>
  42. <xsl:value-of select="description"/>
  43. </xsl:if>
  44.  
  45. I take it that XSL is a little unintuitive since its done via
  46. recursion, but how would i implement something like this? just doing a
  47. test on min -- does it go through all the elements and finds the
  48. minimum?
  49.  
  50.  
  51. Thanks so much.
Add Comment
Please, Sign In to add comment