Guest User

Untitled

a guest
Jul 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 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 currentTime). I want to compare this time to see if it falls within the interval of each of the show on a specific day (ie day 1). If it falls within that timeslot, then I want to grab the description tag. However, if the currentTime is within 30 minutes of the next show, I want the description to update within that 30 minute interval.
  25.  
  26. I can't think out the proper way to do this in XSL. I can store a currentTime and then take the difference of the currentTime and the start time, and then compare the minimums. This is easy to say but how do I code this in xsl?
  27.  
  28. Can I do something a recursive look to find the minimum difference (ie current show?)
  29.  
  30. example:
  31.  
  32. <xsl:if test="min(currentTime-/rss/tvshow/@start)"/>
  33. <xsl:value-of select="description"/>
  34. </xsl:if>
  35.  
  36. I take it that XSL is a little unintuitive since its done via recursion, but how would i implement something like this? just doing a test on min -- does it go through all the elements and finds the minimum?
Add Comment
Please, Sign In to add comment