dmllc Posted May 31, 2006 Share Posted May 31, 2006 http://mlb.mlb.com/partnerxml/gen/news/rss/nym.xmli am trying to select the items that were published on the same date but i am not sure how to do this due to the format of the pubDate element. currently i am simply using <xsl:value-of select="pubDate"/>. also, is there a way to display the pubDate without the time string? Link to comment Share on other sites More sharing options...
boen_robot Posted May 31, 2006 Share Posted May 31, 2006 I don't think XSLT provides dynamical functions to check if a string matches the current date. I think there was some XPath 2.0 function that formats the date so you could then check it, but that's still not supported anywhere.I see that you're using some exslt.org extensions though, so I guess that's just another one you'll need.As for how to select the date without the hour, you could use the substring() function. It would requre a lot of substring() functions if you want to reformat the date though. Link to comment Share on other sites More sharing options...
dmllc Posted June 2, 2006 Author Share Posted June 2, 2006 i think i found a way to accomplish what i want, but the xpath function is not working like i thought it would.<xsl:value-of select="substring('pubDate',1,15)" /> is returning the string pubDate instead of the first 15 characters of a xml pubDate value: Thu, 01 Jun 2006 15:45:00 EDTwhat is the correct xpath function to display Thu, 01 Jun 2006 15:45:00 EDT as Thu, 01 Jun 2006? Link to comment Share on other sites More sharing options...
dooberry Posted June 5, 2006 Share Posted June 5, 2006 get rid of the speechmarks around pubdate: <xsl:value-of select="substring(pubDate,1,15)" /> If you use speechmarks inside an xpath expression/function then xpath thinks that you have put a value between the speechmarks, not the name of the element you need to look at.To see what I mean try: <xsl:value-of select="pubDate" /> and then try: <xsl:value-of select="'pubDate'" /> Link to comment Share on other sites More sharing options...
dmllc Posted June 7, 2006 Author Share Posted June 7, 2006 thx! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now