locked
Content Query WebPart and Custom xsl-stylesheet RRS feed

  • Question

  • Hi,

    I already know how to adjust the content query webpart to show data in a way I whould like to show it...
    But this isn't easy to deploy, I've adjusted the itemstyle.xsl stylesheet in the style library... But now, to package it in a *.wsp as a feature...
    Does someone know a good tutorial about this?!
    I've searched, but I always find tutorials who show how to make adjustments to the itemstyle.xsl of headerstyle.xsl files...

    Can anyone help?!

    Greetz
    Thomas
    Wednesday, January 7, 2009 4:00 PM

Answers

  • Hi,

    heres one example code that i have used:

    in elements.xml
        <Module Url="Style Library/XSL Style Sheets/XXX" Path="Styles" Name="XXXXSLStyles" RootWebOnly="TRUE">
            <File Url="Header.xsl" Type="GhostableInLibrary" />
            <File Url="ItemStyle.xsl" Type="GhostableInLibrary" />
        </Module>   

    XXX is name of project/customer or such. Now in your webpart xml, refer like:

    <property name="HeaderXslLink" type="string">/Style Library/XSL Style Sheets/XXX/Header.xsl</property>
    <property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/XXX/ItemStyle.xsl</property>

    and in feature.xml

    <ElementManifests>
        <ElementManifest Location="elements.xml" />
          <ElementFile Location="Styles/Header.xsl" />
          <ElementFile Location="Styles/ItemStyle.xsl" />
      </ElementManifests>

    and file structure needs to be something like this:

    12\Template\Features\FeatureName\Styles\ItemStyle.xsl
    12\Template\Features\FeatureName\Styles\Header.xsl

    br,

    Heikki
    • Proposed as answer by Ted A Friday, January 9, 2009 10:49 PM
    • Marked as answer by Michael Washam - MSFT Monday, January 12, 2009 3:12 PM
    Thursday, January 8, 2009 12:10 PM
  • Check out the Enhanced Content Query Web Part on Codeplex.

    http://www.codeplex.com/ECQWP

    It includes its own xsl stylesheets that are deployed via the feature and is a more effective way to customize, since you aren't editing the default Microsoft files that could change in a future update.
    Thursday, January 8, 2009 3:34 PM

All replies

  • Hi,

    heres one example code that i have used:

    in elements.xml
        <Module Url="Style Library/XSL Style Sheets/XXX" Path="Styles" Name="XXXXSLStyles" RootWebOnly="TRUE">
            <File Url="Header.xsl" Type="GhostableInLibrary" />
            <File Url="ItemStyle.xsl" Type="GhostableInLibrary" />
        </Module>   

    XXX is name of project/customer or such. Now in your webpart xml, refer like:

    <property name="HeaderXslLink" type="string">/Style Library/XSL Style Sheets/XXX/Header.xsl</property>
    <property name="ItemXslLink" type="string">/Style Library/XSL Style Sheets/XXX/ItemStyle.xsl</property>

    and in feature.xml

    <ElementManifests>
        <ElementManifest Location="elements.xml" />
          <ElementFile Location="Styles/Header.xsl" />
          <ElementFile Location="Styles/ItemStyle.xsl" />
      </ElementManifests>

    and file structure needs to be something like this:

    12\Template\Features\FeatureName\Styles\ItemStyle.xsl
    12\Template\Features\FeatureName\Styles\Header.xsl

    br,

    Heikki
    • Proposed as answer by Ted A Friday, January 9, 2009 10:49 PM
    • Marked as answer by Michael Washam - MSFT Monday, January 12, 2009 3:12 PM
    Thursday, January 8, 2009 12:10 PM
  • Check out the Enhanced Content Query Web Part on Codeplex.

    http://www.codeplex.com/ECQWP

    It includes its own xsl stylesheets that are deployed via the feature and is a more effective way to customize, since you aren't editing the default Microsoft files that could change in a future update.
    Thursday, January 8, 2009 3:34 PM