#SPSBEAn introduction to XSLT in        SharePoint           #SPSBE07          Elio Struyf
About me• Elio Struyf• SharePoint Consultant at Xylos• Brander / Developer• Twitter: eliostruyf• Blog: http://estruyf.be/b...
A big thanks to our sponsorsPlatinum SponsorsGold Premium Sponsors                            Venue SponsorGold Sponsors  ...
Agenda• What is XSLT?• Why use XSLT?• Where to begin• Demo’s                   @eliostruyf - #SPSBE07
WHAT IS XSLT• Extensible Stylesheet Language Transformations• Transforming XML data into something else, ex: HTML• XSLT >=...
COMPARISON WITH CSS               @eliostruyf - #SPSBE07
WHAT IS XSLTXML Data                             OutputXSL Stylesheet                 Processor
XSLT EXAMPLE                                        http://bit.ly/HwJv7G               @eliostruyf - #SPSBE07
WHY USE XSLT?•   It allows you to filter and sort the data•   Apply your own styling and formatting     • Style your data ...
START USING IT!•    Good to know: SP 2007 / 2010 = XSLT 1.0•    SP2010 List views are created with XSLT•    “XSLT is a too...
Data View Web Part: Selecting dataDEMO                              @eliostruyf - #SPSBE07
SELECTING DATA• <xsl:value-of select="@Priority" />• <xsl:value-of select="substring-after(@Priority, ) )" />             ...
List View: StatementsDEMO                        @eliostruyf - #SPSBE07
CONDITIONAL FORMATING•   If Statements: <xsl:if test=“”></xsl:if>•   Choose Element: <xsl:choose><xsl:when test=“”/><xsl:o...
Twitter DemoDEMO               @eliostruyf - #SPSBE07
SHOW HTML CONTENT•   disable-output-escaping=“no”     •   “<“ ”&lt;”•   disable-output-escaping=“yes”     • “<“  “<“    ...
Fiddler – Retrieving the raw XMLDEMO                                                    http://bit.ly/IrsPwU              ...
Feedback via Twitter: #SPSBE07THANK YOU!                             @eliostruyf - #SPSBE07
We need your feedback!               Scan this QR code or visit               http://svy.mk/sps2012be               Our sp...
Upcoming SlideShare
Loading in …5
×

Elio struyf introduction-xslt-spsbe07

475 views
433 views

Published on

The session gives an introduction on using XSLT or Extensible Stylesheet Language Transformations (http://www.w3.org/TR/xslt) in your SharePoint environment, and focuses on SharePoint users which have never used XSLT.
XSLT can be used for transforming structured information like XML. You will learn how to retrieve the XML from a particular SharePoint list, and how to transform your list data with the help of a Data View Web Part to in another format like HTML. The last step is to transform some external data, like for example a Twitter search feed.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
475
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • TwoKeywords: Stylesheet – TransformationsXSLT canbecomparedwith CSS, but it is more powerful. They are bothusedtotellhoweach element shouldbedisplayed.XSLT is based on pattern matching. It mainlycontains templates that are usedtotransform the document.CSS cannot do forexample:Change the elements order in whichtheyappear in the document;Cannot do computations, ifyou want tocalculateand output a value;Cannot combine multiple documents.
  • Processor:- Client Side – on the fly: http://www.w3schools.com/xsl/xsl_client.asp- Server Side (SharePoint)Test XSLT online tool: http://xslttest.appspot.com/&lt;?xml version=&quot;1.0&quot; ?&gt;&lt;greeting&gt; Welcome to the #SPSBE07 session!&lt;/greeting&gt;&lt;?xmlversion=&quot;1.0&quot; ?&gt;&lt;xsl:stylesheetversion=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt; &lt;xsl:outputmethod=&quot;html&quot; /&gt; &lt;xsl:template match=&quot;/&quot;&gt; &lt;html&gt; &lt;body&gt; &lt;xsl:apply-templates select=&quot;greeting&quot; /&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; &lt;xsl:template match=&quot;greeting&quot;&gt; &lt;h1&gt; &lt;xsl:value-of select=&quot;.&quot; /&gt; &lt;/h1&gt; &lt;/xsl:template&gt;&lt;/xsl:stylesheet&gt;
  • You do notdepend on the XML structure.
  • Normallyyouneedtocreate a separate XSL file, butwith SharePoint Designer thisprocessisn’tneeded.
  • &lt;xsl:choose&gt; &lt;xsl:when test=&quot;normalize-space($thisNode/@Status) = &apos;Deferred&apos;&quot;&gt; background-color: #FFCFD1; &lt;/xsl:when&gt; &lt;xsl:when test=&quot;normalize-space($thisNode/@Status) = &apos;Completed&apos;&quot;&gt; background-color: #DFFFDF; &lt;/xsl:when&gt; &lt;xsl:when test=&quot;@Status=&apos;In Progress&apos;&quot;&gt; background-color: #DFDFDF; &lt;/xsl:when&gt; &lt;xsl:otherwise&gt; background-color: transparent; &lt;/xsl:otherwise&gt;&lt;/xsl:choose&gt;&lt;xsl:if test=&quot;ddwrt:FormatDateTime(@DueDate, 1033, &apos;yyyyMMdd&apos;) &amp;lt;= ddwrt:FormatDateTime(ddwrt:Today(), 1033, &apos;yyyyMMdd&apos;)&quot;&gt; font-weight: bold;&lt;/xsl:if&gt;
  • http://search.twitter.com/search.rss?q=QUERY&amp;rpp=TOTAL
  • Optional. &quot;yes&quot; indicates that special characters (like &quot;&lt;&quot;) should be output as is. &quot;no&quot; indicates that special characters (like &quot;&lt;&quot;) should be output as &quot;&amp;lt;&quot;. Default is &quot;no&quot;
  • Elio struyf introduction-xslt-spsbe07

    1. 1. #SPSBEAn introduction to XSLT in SharePoint #SPSBE07 Elio Struyf
    2. 2. About me• Elio Struyf• SharePoint Consultant at Xylos• Brander / Developer• Twitter: eliostruyf• Blog: http://estruyf.be/blog @eliostruyf - #SPSBE07
    3. 3. A big thanks to our sponsorsPlatinum SponsorsGold Premium Sponsors Venue SponsorGold Sponsors @eliostruyf - #SPSBE07
    4. 4. Agenda• What is XSLT?• Why use XSLT?• Where to begin• Demo’s @eliostruyf - #SPSBE07
    5. 5. WHAT IS XSLT• Extensible Stylesheet Language Transformations• Transforming XML data into something else, ex: HTML• XSLT >= CSS Value = 1 XML Doc31 Value = First name Last name Value = 5 Combined XML name Last Doc82 Total = 20 First name Value = Value = 2 Value = 1 @eliostruyf - #SPSBE07
    6. 6. COMPARISON WITH CSS @eliostruyf - #SPSBE07
    7. 7. WHAT IS XSLTXML Data OutputXSL Stylesheet Processor
    8. 8. XSLT EXAMPLE http://bit.ly/HwJv7G @eliostruyf - #SPSBE07
    9. 9. WHY USE XSLT?• It allows you to filter and sort the data• Apply your own styling and formatting • Style your data in different formats• Doing calculations• Easy to use in SharePoint @eliostruyf - #SPSBE07
    10. 10. START USING IT!• Good to know: SP 2007 / 2010 = XSLT 1.0• SP2010 List views are created with XSLT• “XSLT is a tool, not a religion” – Doug Tidwell @eliostruyf - #SPSBE07
    11. 11. Data View Web Part: Selecting dataDEMO @eliostruyf - #SPSBE07
    12. 12. SELECTING DATA• <xsl:value-of select="@Priority" />• <xsl:value-of select="substring-after(@Priority, ) )" /> @eliostruyf - #SPSBE07
    13. 13. List View: StatementsDEMO @eliostruyf - #SPSBE07
    14. 14. CONDITIONAL FORMATING• If Statements: <xsl:if test=“”></xsl:if>• Choose Element: <xsl:choose><xsl:when test=“”/><xsl:otherwise /></xsl:choose> @eliostruyf - #SPSBE07
    15. 15. Twitter DemoDEMO @eliostruyf - #SPSBE07
    16. 16. SHOW HTML CONTENT• disable-output-escaping=“no” • “<“ ”&lt;”• disable-output-escaping=“yes” • “<“  “<“ @eliostruyf - #SPSBE07
    17. 17. Fiddler – Retrieving the raw XMLDEMO http://bit.ly/IrsPwU @eliostruyf - #SPSBE07
    18. 18. Feedback via Twitter: #SPSBE07THANK YOU! @eliostruyf - #SPSBE07
    19. 19. We need your feedback! Scan this QR code or visit http://svy.mk/sps2012be Our sponsors:

    ×