2

I'm replacing the default ItemStyle.xsl with a custom xsl file, my xsl file contains the default xsl:stylesheet and a xsl:template looking something like this

<xsl:template name="CustomDescription" match="Row[@Style='CustomDescription']" mode="itemstyle">
    ... standard implementation ...
    <div class="description">
      <!--<xsl:value-of select="@Description" />-->
      <!-- custom implementation Transform the field data -->
      <xsl:call-template name="remove-html">
        <xsl:with-param name="text" select="@Description"/>
      </xsl:call-template>
    </div>
  </div>
</xsl:template>

The content query web part

<a08fba8b1:contentbyquerywebpart runat="server" itemstyle="CustomDescription" groupstyle="DefaultHeader" contenttypebeginswithid="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF390095DBEA0C683D4CF9A13D8FB79460C86E" weburl="~sitecollection/" listguid="ba182bbc-d749-4c48-9bcc-25906ed5cf57" listname="Pages" filter1chainingoperator="Or" filter2chainingoperator="Or" datamappingviewfields="{94f89715-e097-4e8b-ba79-ea02aa8b7adb},Lookup;{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},Image;{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Text;{f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8},HTML;" groupbydirection="Desc" sortby="Created" sortbyfieldtype="DateTime" sortbydirection="Desc" datamappings="Description:{f55c4d88-1f2e-4ad9-aaa8-819af4ee7ee8},PublishingPageContent,HTML;|ImageUrl:{543bc2cf-1f30-488e-8f25-6fe3b689d9ac},PublishingRollupImage,Image;|Title:{fa564e0f-0c70-4ab9-b863-0177e6ddd247},Title,Text;|LinkUrl:{94f89715-e097-4e8b-ba79-ea02aa8b7adb},FileRef,Lookup;|" showuntargeteditems="False" enableoriginalvalue="False" viewflag="0" viewcontenttypeid="" listid="00000000-0000-0000-0000-000000000000" pagesize="-1" usesqldatasourcepaging="True" datasourceid="" showwithsampledata="False" asyncrefresh="False" manualrefresh="False" autorefresh="False" autorefreshinterval="60" initialasyncdatafetch="False" title="Topics" frametype="TitleBarOnly" suppresswebpartchrome="False" description="&lt;%$Resources:cmscore,ContentQueryWebPart_Description%&gt;" isincluded="True" zoneid="ImportedPartZone" partorder="0" framestate="Normal" allowremove="True" allowzonechange="True" allowminimize="True" allowconnect="True" allowedit="True" allowhide="True" isvisible="True" detaillink="" helplink="" helpmode="Modeless" dir="Default" partimagesmall="" missingassembly="&lt;%$Resources:cmscore,WebPartImportError%&gt;" importerrormessage="&lt;%$Resources:cmscore,WebPartImportError%&gt;" partimagelarge="" isincludedfilter="" exportcontrolledproperties="True" connectionid="00000000-0000-0000-0000-000000000000" id="g_7e02ede6_721a_49f8_b781_a1ca2ba84b20" chrometype="TitleOnly" exportmode="All" preview="&lt;Regions&gt;&lt;Region Name=&quot;0&quot; Editable=&quot;True&quot; Content=&quot;&quot; NamingContainer=&quot;True&quot; /&gt;&lt;/Regions&gt;&lt;div class=&quot;ms-webpart-chrome ms-webpart-chrome-vertical ms-webpart-chrome-fullWidth &quot;&gt;  &lt;div class=&quot;ms-webpart-chrome-title&quot; id=&quot;WebPartwpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20_ChromeTitle&quot;&gt;   &lt;span title=&quot;$Resources:cmscore,ContentQueryWebPart_Title - $Resources:cmscore,ContentQueryWebPart_Description&quot; id=&quot;WebPartTitlewpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20&quot; class=&quot;js-webpart-titleCell&quot;&gt;&lt;div class=&quot;ms-webpart-titleText&quot;&gt;&lt;nobr&gt;&lt;span&gt;$Resources:cmscore,ContentQueryWebPart_Title&lt;/span&gt;&lt;span id=&quot;WebPartCaptionwpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20&quot;&gt;&lt;/span&gt;&lt;/nobr&gt;&lt;/div&gt;&lt;/span&gt;  &lt;/div&gt;&lt;div WebPartID=&quot;00000000-0000-0000-0000-000000000000&quot; HasPers=&quot;true&quot; id=&quot;WebPartwpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20&quot; width=&quot;100%&quot; class=&quot;ms-WPBody noindex ms-wpContentDivSpace &quot; OnlyForMePart=&quot;true&quot; allowDelete=&quot;false&quot; style=&quot;&quot; &gt;&lt;div id=&quot;WebPartContent&quot;&gt;   &lt;div class=&quot;ms-webpart-chrome ms-webpart-chrome-vertical ms-webpart-chrome-fullWidth &quot;&gt;  &lt;div WebPartID=&quot;00000000-0000-0000-0000-000000000000&quot; HasPers=&quot;true&quot; id=&quot;WebPartwpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20&quot; width=&quot;100%&quot; class=&quot;ms-WPBody noindex &quot; OnlyForMePart=&quot;true&quot; allowDelete=&quot;false&quot; SelectedWebPart=&quot;true&quot; style=&quot;&quot; &gt;&lt;div id=&quot;WebPartContent&quot;&gt;&lt;div id=&quot;cbqwpwpz7_g_7e02ede6_721a_49f8_b781_a1ca2ba84b20&quot; class=&quot;cbq-layout-main&quot;&gt;&lt;ul class=&quot;dfwp-column dfwp-list&quot; style=&quot;width:100%&quot; &gt;&lt;li class=&quot;dfwp-item&quot;&gt;&lt;div class=&quot;groupheader item medium&quot;&gt;Group Header&lt;/div&gt;&lt;ul class=&quot;dfwp-list&quot;&gt;&lt;li class=&quot;dfwp-item&quot;&gt;&lt;div class=&quot;item&quot;&gt;&lt;div class=&quot;link-item&quot;&gt;&lt;a href=&quot;http://Item1&quot; title=&quot;&quot;&gt;Item 1&lt;/a&gt;&lt;div class=&quot;description&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;dfwp-item&quot;&gt;&lt;div class=&quot;item&quot;&gt;&lt;div class=&quot;link-item&quot;&gt;&lt;a href=&quot;http://Item2&quot; title=&quot;&quot;&gt;Item 2&lt;/a&gt;&lt;div class=&quot;description&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;dfwp-item&quot;&gt;&lt;div class=&quot;item&quot;&gt;&lt;div class=&quot;link-item&quot;&gt;&lt;a href=&quot;http://Item3&quot; title=&quot;&quot;&gt;Item 3&lt;/a&gt;&lt;div class=&quot;description&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Themable/Core%20Styles/controls15.css&quot;/&gt; &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;/Style%20Library/en-US/Themable/Core%20Styles/controls15.css&quot;/&gt; &lt;/div&gt;&lt;div class=&quot;ms-clear&quot;&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;  &lt;/div&gt;&lt;div class=&quot;ms-clear&quot;&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;" __markuptype="vsattributemarkup" __webpartid="{7e02ede6-721a-49f8-b781-a1ca2ba84b20}" webpart="true" height="" width="">
    <Xsl>
        <xsl:stylesheet version="1.0" exclude-result-prefixes="xsl cmswrt x">
            <xsl:import href="/Style Library/XSL Style Sheets/Header.xsl">
            </xsl:import>
            <xsl:import href="/_layouts/15/herlitz.site/xsl/CustomDescriptionItemStyle.xsl">
            </xsl:import>
            <xsl:import href="/Style Library/XSL Style Sheets/ContentQueryMain.xsl">
            </xsl:import>
        </xsl:stylesheet>
    </Xsl>
    <SampleData>
        <dsQueryResponse>
            <Rows>
                <Row Title="Item 1" LinkUrl="http://Item1" Group="Group Header" __begincolumn="True" __begingroup="True"></Row>
                <Row Title="Item 2" LinkUrl="http://Item2" __begincolumn="False" __begingroup="False"></Row>
                <Row Title="Item 3" LinkUrl="http://Item3" __begincolumn="False" __begingroup="False"></Row>
            </Rows>
        </dsQueryResponse>
    </SampleData>
    <DataFields>
    </DataFields>
</a08fba8b1:contentbyquerywebpart>

The issue is that is seems to ignore the CustomDescriptionItemStyle.xsl and loads the ItemStyle.xsl instead.

Any advice? Thanks

  • I assume you exported CQWP and modified xsl paths and then re-imported the webpart? cwheeler76.com/Lists/Posts/… – dotsa Feb 25 '14 at 23:32
  • @dotsa Hmm nope, configured as it is in the post. Will try to use the designer for this – Eric Herlitz Feb 26 '14 at 6:55

Your Answer

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

Browse other questions tagged or ask your own question.