XmlDataSource XPath Query Help

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?
LVL 16
TSmoothAsked:
Who is Participating?
 
jkmyoungConnect With a Mentor Commented:
I think the problem is you're trying to use XPATH 2.0 functions (distinct(), year-from-duration()), when ASP generally only recognizes XPATH 1.0

I suggest trying a simpler xpath 1.0 expression first: eg
BlogEntries/BlogEntry[@date]
and sort on the date.

Here's a list of XPATH 1.0 functions:
http://www.mulberrytech.com/quickref/XSLT_1quickref-v2.pdf 
0
 
TSmoothAuthor Commented:
Thanks for your reply, I'm going to have to come up with another plan to do what I wanted.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.