DVWP Returning No Items Was Driving Me Crazy (And the Fix)

This is one of those “How could I have been so stupid?” things.  I like to tell all of you about these in the hopes that if you read the post, it’ll lodge somewhere in the back of your mind and the next time you find yourself cursing and unable to figure some silly thing out, you will remember it.

This one is a humdinger.  Somehow in working in a DVWP today, I ended up with this line:

<xsl:variable name="Rows" select="/dsQueryResponse/Requests_for_PTO/Rows"/>

Can you see a problem with it? Well, I was tearing my hair out because my DVWP wasn’t returning the items that I expected. I combed the DataSource settings (it’s an AggregateDataSource, so a little more complex than the usual), the DataFormWebPart (DVWP) settings, the ParameterBindings, everything that I could think of.

Turns out, I’d simply typed the line wrong in the first place.  It’s like one of those misplaced commas or semicolons that you just can’t see for the longest time:

<xsl:variable name="Rows" select="/dsQueryResponse/Requests_for_PTO/Rows/Row"/>

See the difference? If you leave of the final /Row, you’ll get no items back. No errors, no problems, but no items.

I’m guessing that this is yet another of the many things that are almost always our own damn faults that people curse SharePoint Designer for,  It wasn’t SPD; it was me.  All better now, though.

Have a thought or opinion?