Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've got an xslt list view. I have one column that should be used in the xslt calculation (shown as a row tooltip) but it should not be visible as a column in the list.

Question: Must the column be included in the viewfields list in order to be used in the transform? If so, how can I prevent that column from beeing shown? (not using spd)

Thanks

Larsi

share|improve this question
    
Just a future visitor FYI, see user14949's answer below for the quickest method (it requires adding two words to one line in the view aspx, using SharePoint Designer). –  Matt Aug 20 '13 at 10:13
add comment

3 Answers 3

up vote 2 down vote accepted

The XSLT will basically draw a template of HTML which wraps the output of the data query. If you look through the XSLT you'll see various TR TD html elements around which draw the table.

You will need to remove the TD elements which represent the column which you are trying to hide.

This is easiest done with SharePoint Designer as you'll have the syntax highlighting and instant feedback through the Design Window to see what you're doing.

For a walkthrough of how the XSLT works with DataViewWebParts (functionally similar to the XLV), have a quick scan through Marc Anderson's blog series on this:

http://www.endusersharepoint.com/2010/01/19/unlocking-the-mysteries-of-data-view-web-part-xsl-tags-part-1-overview/

I also wrote a blog post on cleaning up the XSLT to draw the output the way I wanted, have a look here:

http://e-junkie-chronicles.blogspot.com/2010/03/sharepoint-designer-dataview-web-parts.html

share|improve this answer
    
Agree that SPD is a better tool for doing this. –  SPDoctor Apr 4 '11 at 8:57
    
user14949's answer below works, and does not require removing table elements. the Explicit property, added to the FieldRef, hides the column from my view. –  Matt Aug 20 '13 at 10:11
add comment

You can use an identity transformation to see the xml that is being sent to the XSLT engine.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

You can use this to check if you are seeing all the fields you need in the XML passed to the XSLT engine.

Suppressing the output of the column can be achieved by modifying the XSLT, depending on how comfortable you are editing XSLT. Personally I don't think it's as bad a some people say it is!

share|improve this answer
    
Hi! Thanks for looking into this. Yes, I think it's time to really start learning the xslt... –  Larsi Apr 4 '11 at 8:49
    
Your XSLT is transforming an XML input document containing the field values. The identity transform renders this without change, enabling you to check that all the fields you need (for your calculation) are there. So you can temporarily replace your XSLT with the sample above, for diagnostic purposes. –  SPDoctor Apr 4 '11 at 8:52
    
Thanks, that's a good tip! –  Larsi Apr 4 '11 at 8:57
add comment

Explicit attribute will hide the column in the webpart <FieldRef Name="LinkFilename" Explicit="TRUE"/>

share|improve this answer
    
This was exactly what I needed. Searched for "Hide FieldRef" and bingo. Thanks. –  Matt Aug 20 '13 at 10:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.