0

I'm a bit of a SharePoint beginner, so please forgive me if this is a very basic question.

I have a parent site with a number of identical team sites below it. The requirement is that each team site has an announcement list, and these are aggregated into a master view on the parent site.

I have had some success doing this, basically I created a new aspx page and added a data source to this containing the announcement lists from the subsites, then saved this by pushing it out as a web part to the site gallery.

The problem I have is that the body text of the announcement is surrounded by code. I thought the solution to this would be to set the 'disable-output-escaping' property to yes, but this is already set and i still have the problem.

aggregate list on the sp site

Here is what the xsl looks like at the moment:

' 1 0

<xsl:template match="/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:agg="http://schemas.microsoft.com/sharepoint/aggregatesource" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
    <xsl:choose>
        <xsl:when test="($ManualRefresh = 'True')">
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td valign="top">
                        <xsl:call-template name="dvt_1"/>
                    </td>
                    <td width="1%" class="ms-vb" valign="top">
                        <img src="/_layouts/15/images/staticrefresh.gif" id="ManualRefresh" border="0" onclick="javascript: {ddwrt:GenFireServerEvent('__cancel')}" alt="Click here to refresh the dataview."/>
                    </td>
                </tr>
            </table>
        </xsl:when>
        <xsl:otherwise>
            <xsl:call-template name="dvt_1"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="dvt_1">
    <xsl:variable name="dvt_StyleName">Table</xsl:variable>
    <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
    <xsl:variable name="dvt_RowCount" select="count($Rows)"/>
    <xsl:variable name="RowLimit" select="10" />
    <xsl:variable name="FirstRow" select="$dvt_firstrow" />
    <xsl:variable name="LastRow">
        <xsl:choose>
            <xsl:when test="($FirstRow + $RowLimit - 1) &gt; $dvt_RowCount"><xsl:value-of select="$dvt_RowCount" /></xsl:when>
            <xsl:otherwise><xsl:value-of select="$FirstRow + $RowLimit - 1" /></xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="IsEmpty" select="$dvt_RowCount = 0" />
    <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0"/>

    <xsl:choose>
        <xsl:when test="$dvt_IsEmpty">
            <xsl:call-template name="dvt_1.empty"/>
        </xsl:when>
        <xsl:otherwise>
            <table border="0" width="100%" cellpadding="2" cellspacing="0">
                <tr valign="top">
                    <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
                        <th class="ms-vh" width="1%" nowrap="nowrap"></th>
                    </xsl:if>
                    <th class="ms-vh" nowrap="nowrap">Title</th>
                    <th class="ms-vh" nowrap="nowrap">Modified By</th>
                    <th class="ms-vh" nowrap="nowrap">Modified</th>
                </tr>
                <xsl:call-template name="dvt_1.body">
                    <xsl:with-param name="Rows" select="$Rows[position() &gt;= $FirstRow and position() &lt;= $LastRow]"/>
                    <xsl:with-param name="FirstRow" select="1" />
                    <xsl:with-param name="LastRow" select="$dvt_RowCount" />
                </xsl:call-template>
            </table>
        </xsl:otherwise>
    </xsl:choose>
    <xsl:call-template name="dvt_1.commandfooter">
        <xsl:with-param name="FirstRow" select="$FirstRow" />
        <xsl:with-param name="LastRow" select="$LastRow" />
        <xsl:with-param name="RowLimit" select="$RowLimit" />
        <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
        <xsl:with-param name="RealLastRow" select="number(ddwrt:NameChanged('',-100))" />
    </xsl:call-template>
</xsl:template>
<xsl:template name="dvt_1.body">
    <xsl:param name="Rows"/>
    <xsl:param name="FirstRow" />
    <xsl:param name="LastRow" />
    <xsl:for-each select="$Rows">
        <xsl:variable name="dvt_KeepItemsTogether" select="false()" />
        <xsl:variable name="dvt_HideGroupDetail" select="false()" />
        <xsl:if test="(position() &gt;= $FirstRow and position() &lt;= $LastRow) or $dvt_KeepItemsTogether">
            <xsl:if test="not($dvt_HideGroupDetail)" ddwrt:cf_ignore="1">
                <xsl:call-template name="dvt_1.rowview" />
            </xsl:if>
        </xsl:if>
    </xsl:for-each>

</xsl:template>
<xsl:template name="dvt_1.rowview">
    <tr>
        <xsl:if test="position() mod 2 = 1">
            <xsl:attribute name="class">ms-alternating</xsl:attribute>
        </xsl:if>
        <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">
            <td class="ms-vb" width="1%" nowrap="nowrap">
                <span ddwrt:amkeyfield="" ddwrt:amkeyvalue="string($XPath)" ddwrt:ammode="view"></span>
            </td>
        </xsl:if>
        <td class="ms-vb">
            <xsl:value-of select="@Title"/>
        </td>
        <td class="ms-vb">
            <xsl:value-of select="@Editor"/>
        </td>
        <td class="ms-vb">
            <xsl:value-of select="ddwrt:FormatDate(string(@Modified), 1033, 5)"/>
        </td>
    </tr>
</xsl:template>
<xsl:template name="dvt_1.empty">
    <xsl:variable name="dvt_ViewEmptyText">There are no items to show in this view.</xsl:variable>
    <table border="0" width="100%">
        <tr>
            <td class="ms-vb">
                <xsl:value-of select="$dvt_ViewEmptyText"/>
            </td>
        </tr>
    </table>
</xsl:template>
<xsl:template name="dvt_1.commandfooter">
    <xsl:param name="FirstRow" />
    <xsl:param name="LastRow" />
    <xsl:param name="RowLimit" />
    <xsl:param name="dvt_RowCount" />
    <xsl:param name="RealLastRow" />
    <table cellspacing="0" cellpadding="4" border="0" width="100%">
        <tr>
            <xsl:if test="$FirstRow &gt; 1 or $LastRow &lt; $dvt_RowCount">
                <xsl:call-template name="dvt_1.navigation">
                    <xsl:with-param name="FirstRow" select="$FirstRow" />
                    <xsl:with-param name="LastRow" select="$LastRow" />
                    <xsl:with-param name="RowLimit" select="$RowLimit" />
                    <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
                    <xsl:with-param name="RealLastRow" select="$RealLastRow" />
                </xsl:call-template>
            </xsl:if>
        </tr>
    </table>
</xsl:template>
<xsl:template name="dvt_1.navigation">
    <xsl:param name="FirstRow" />
    <xsl:param name="LastRow" />
    <xsl:param name="RowLimit" />
    <xsl:param name="dvt_RowCount" />
    <xsl:param name="RealLastRow" />
    <xsl:variable name="PrevRow">
        <xsl:choose>
            <xsl:when test="$FirstRow - $RowLimit &lt; 1">1</xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$FirstRow - $RowLimit" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="LastRowValue">
        <xsl:choose>
            <xsl:when test="$LastRow &gt; $RealLastRow">
                <xsl:value-of select="$LastRow"></xsl:value-of>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$RealLastRow"></xsl:value-of>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <xsl:variable name="NextRow">
        <xsl:value-of select="$LastRowValue + 1"></xsl:value-of>
    </xsl:variable>
    <td nowrap="nowrap" class="ms-paging" align="right">
        <xsl:if test="$dvt_firstrow &gt; 1" ddwrt:cf_ignore="1">
            <a>
            <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent('dvt_firstrow={1}')" />;</xsl:attribute>
            Start</a>
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
            <a>
            <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$PrevRow,'}'))" />;</xsl:attribute>
            <img src="/_layouts/15/images/prev.gif" border="0" alt="Previous" />
            </a>
            <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
        </xsl:if>
        <xsl:value-of select="$FirstRow" />
         - <xsl:value-of select="$LastRowValue" />
        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
        <xsl:if test="$LastRowValue &lt; $dvt_RowCount or string-length($dvt_nextpagedata)!=0" ddwrt:cf_ignore="1">
            <a>
            <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$NextRow,'}'))" />;</xsl:attribute>
            <img src="/_layouts/15/images/next.gif" border="0" alt="Next" />
            </a>
        </xsl:if>
    </td>
</xsl:template>

Any advice or tips would be greatly appreciated.

1

Just change your:

 <xsl:value-of select="@Editor"/>

for:

<xsl:value-of select="@Editor.title"/>

It works the same with Author(Created by)

And also you can get more properties, if you click in "Data source details" in the options tab of your SharePoint Designer, you can see all properties from your item:

enter image description here

  • Thank you @Thales :) That helpded a lot, and fixed the problem with that field. Now I have added 'Body' for the body text of the list items, but this either displays with the code around it, and if I add '.title' to the body field in the same way, it just disappears. Any idea what I would have to add to this line to get it to display correctly? <xsl:value-of select="@Body" /></td><td class="ms-vb"> Thank you for your help :) – Owen Forsey Nov 11 '16 at 17:07
  • Wich type of data are you using for your column named body? – Thales Chemenian Nov 11 '16 at 17:15
  • Hmm I'm not too sure. i can view data source details and get the list as you show above, it does list the body field, but I can't see any option to view field properties. All that's in the source list fields is plain text data. – Owen Forsey Nov 11 '16 at 17:30
  • In this case try to add disable-output-escaping="yes" in your xsl:value-of – Thales Chemenian Nov 11 '16 at 18:37
  • That did it!! I had to play around as I'm not familiar with the syntax, but basically this row did the trick - <xsl:value-of disable-output-escaping="yes" select="@Body"/> Thank you for your help Thales :) – Owen Forsey Nov 14 '16 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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