Question

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)

Was it helpful?

Solution

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

OTHER TIPS

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

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top