troubleshooting Question

XmlDataSource XPath Query Help

Avatar of TSmooth
TSmooth asked on
Web Languages and StandardsXMLASP.NET
2 Comments1 Solution1475 ViewsLast Modified:
I have an ASP.NET web form page on which I'm going to use repeater controls along with an xmlDataSource to display an archived listing of blog entries. I'm used to using databases and not working with XML so I'm not completely familiar with the XPath syntax. The xml file looks like this (minus the prefixed periods):

<BlogEntries>
..<BlogEntry @date="7/23/07 10:00 AM" @poster="John Doe" @title="This is a blog post" @id="123456">
....<![CDATA[<p>This is also a test post.</p>]]>
..</BlogEntry>
..<BlogEntry @date="5/10/07 3:00 PM" @poster="John Doe" @title="Test Post" @id="12345">
....<![CDATA[<p>This is a test post.</p>]]>
..</BlogEntry>

What I want to do is to have my page look something like this:

July 2007
- This is a blog post. (Posted by John Doe on 7/23/07 @ 10:00 AM)
May 2007
- Test Post (Posted by John Doe on 5/10/07 @ 3:00 PM)

I've tried using an XPath filter on the xml data source like such:
BlogEntries/BlogEntry[distinct-values(year-from-duration(@date))] just to get started and other various ways from looking at documenation online but I always either get no results or I get error messages about user defined functions like it doesn't recognize distinct-values() or year-from-duration().

How can I go about getting to what I want? Also, does asp.net's XML Data source only support minimal functionality of XPath queries or was I just using distinct-values and other XPath functions incorrectly?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros