Link to home
Start Free TrialLog in
Avatar of CptO
CptOFlag for United States of America

asked on

Problems linking document title to the document in XsltListViewWebpart

using SP2010 and SPD 2010

I have added a XLST lsit View for a document library to a SharePoint web page. I have added just the "Title" column  ( <xsl:value-of select="$thisNode/@Title" /> ) in the view . I am attempting to link the title back to the document using

<a href="{$thisNode/@FileRef.urlencodeasurl}"><xsl:value-of select="$thisNode/@Title" />

While in SPD 2010 this hyperlink works. When I view the page in a web browser , the link resolves to the folder of the web page. That is, if the web page is "\sites\MySite\default.aspx", the title link resolves to "\sites\MySite\" instead of the expected ""\Sites\MySite\MyDocumentLibrary\Document.pdf"

A little research and experimentation has revealed that if I add "URL path" as a second column to the view ,  the title hyperlink works fine. If I remove that and leave only the title column, the links no longer work.

I have seen a few other users are  having this problem and have yet to find a  solution that does not require coding changes at the server level (not allowed to do that here) or handcoding every single page. Our server  admins wish to to stay OOTB as much as possible, and will not support extensive manual coding.



Any suggestions on a resolution?
TileURLWorks.jpg
TileURLDoesNot-Work.jpg
Avatar of jessc7
jessc7
Flag of United States of America image

Did you try selecting "Show Link to Item"? See screenshot...

User generated image
ASKER CERTIFIED SOLUTION
Avatar of jessc7
jessc7
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CptO

ASKER

Hmm. If insert a the document library using insert DataView part (as I described in my first post, it does not work as described above. If I do as you suggest, and insert a blank DataView part, then source the same document library, I can use TITLE as a field and hyperlink it back to @fileref, and it works just as it did in SP 2007
using your suggestion the code I see is
<td class="ms-vb">
<a href="{@FileRef}"><xsl:value-of select="@Title" /></a></td>

Using my original method The code I see is

<xsl:choose>
<xsl:when test="@AutoHyperLink='TRUE'">
 <a href="{$thisNode/@FileRef}"><xsl:value-of select="$thisNode/@*[name()=current()/@Name]" disable-output-escaping="yes" /></a></xsl:when>
<xsl:otherwise>
        <xsl:value-of select="$thisNode/@*[name()=current()/@Name]"/>
      </xsl:otherwise>
</xsl:choose>


Out of curiosity , and for my own knowledge, any idea whyyour suggestion work and my method does not? On the surface it appears to be the same method except one is the SP2010 new method and the other is the SP2007 method.
To be honest, I'm not really sure why you (and others) have encountered that issue with the List View Web Part, but I have found the Data View Web Part to be more flexible for what I want to accomplish.
Avatar of CptO

ASKER

I agree and thanks got the answer. I was under the impression, after many hours of looking, that the 2007 Style DVWP no longer existed unless you manually coded it. It appears I was wrong and Microsoft just made it difficult to find. Again thanks got the answer. It will simify a lot of changes I need to make after our migration to 2010.
Glad to help! Good luck with your migration.