XSLTListViewWebpart and filters

  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.

This morning's lesson -- the XSLTListWebPart starts to break horribly in Designer as soon as you deviate from Microsoft's expected templates and patterns.

Case in point: as soon as you use multiple <xsl:template name=""> elements in the stylesheet, the Filter stops working. There's a caveat on that -- it works as long as you delimit the templates using the mode="" attribute and call them using <xsl:apply-templates> rather than <xsl:call-template name="">. So for example:


  <xsl:template match="/" >
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
    <xsl:for-each select="$Rows">
      <xsl:call-template name="RowView" />
    </xsl:for-each>
  </xsl:template>

  <xsl:template name="RowView">
    <xsl:value-of select="@Title" /><br/>
  </xsl:template>

will then make the "Filter" button stop working in Designer, but using:


  <xsl:template match="/" >
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
    <xsl:apply-templates select="$Rows" mode="RowView" />
  </xsl:template>

  <xsl:template match="Row" mode="RowView">
    <xsl:value-of select="@Title" /><br/>
  </xsl:template>

doesn't (despite producing an identical result).

[I♡SharePoint]

Comments

Oh Really?

as soon as you deviate from Microsoft's expected templates and patterns

Why am I not surprised? This really needs to be included in all Microsoft technologies.

I expect because, if I recall correctly,"mode" is in effect setting a psuedo-namespace for the XSL so its got a different signature.

Or not. Its been a few years since I touched XSL, and never within a SharePoint context.