sorting displays in DVWP


I saw this awesome post:

but I was wondering where specifically within the DVWP do you add this?

whenever i try to edit anything in the DVWP i get SPD xsl errors...

would also like to add an image next to the Add new Item link but that's a bonus question if you are so inclined.  

Attached is the text of my DVWP
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:

DVWP and the underlying XSL can be very confusing. You need to understand that you can assign your own names to the XSL templates. Marc has his own naming convention, and he introduces an XSL template called "SortHeader" in the blog post.

He also points out that "The cool line is #8" (of the first code window). This command needs to go after the command

<xsl:for-each select="$Rows">

So, find that statement. In your code, it is in line 72,. After that, in the next line add the sort command

       <xsl:sort select="@*[name()=$SortField]" order="{$AscDesc}" />  

That's the starting point.

If you want to master the technique Marc describes in this blog post, you will need to learn a little bit about how DVWPs work and how the underlying XSL is linked together.

This may sound daunting, but fear not. Marc has also written an excellent 20 part tutorial, published in his blog, called "Unlocking the mysteries of data view web part xsl". The first part is here:

This is an excellent introduction into the inner workings of the DVWP and a primer for XSL. I have not found a comparable source on the web that covers XSL in a SharePoint context, especially with a view to DVWPs.

So, take a couple of hours and go through the "Unlocking .." tutorial. After that, you will feel a lot more confident when it comes to tweaking code for DVWPs. You will understand how to use the template listed in the blog post you linked to, and things more likely than not just fall into place.

I went from zero knowledge about XSL and DVWPs to this article in two days, thanks to Marc's tutorial.

cheers, teylyn

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sullisnyc44Author Commented:
thank you so much. I will give it a try. I know marc's blog is awesome - have to carve out some time to go through it!

I'm trying also trying to create hyperlinks to the calendar list item in this DVWP without much luck.

I have this in the hyperlink of my title field of a calendar event


but it creates a link that looks like this


what am I doing wrong?

needs to look like
Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:
I saw that in your it your other question, but I have no suggestion.
sullisnyc44Author Commented:
needs to be hard coded - no other way around it. crazy.

where do I add that xls header template of mark's? at the top of the xsl of the DVWP?

Ingeborg Hawighorst (Microsoft MVP / EE MVE)Microsoft MVP ExcelCommented:

the position of a template in the xsl does not really matter, as far as I'm aware. Just make sure that it is not nested inside another template, i.e. make sure to put it right after the closing </template> tag of another template. For readability's sake, I'd put the template after the code from which it is being called.

cheers, teylyn
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.