0

Now I do a webpart with XSLT when only show data, but no know if is better make it with code .Net.

for Example in XSLT:

XSLT and SharePoint – Part 1

XSLT and SharePoint – Part 2

what is the advantage of the do it in .Net or XSLT?

is used the XSLT in SharePoint 2013 yet ?

1 Answer 1

1

Developing a web part in Visual Studio is much better than using XSLT as it gives you full control over what you are doing. XSLT is limited and SharePoint only supports XSLT version 1.0.

For e.g. if you are displaying a list or library from some other site then you will need to use Content Query Web Part (CQWP) and in this case applying XSLT is not easy.

EDIT

Let's say you have a list with two columns; Title and Name. And you want to display them in HTML table then it will be something like this:

<!--
This section is the set up and can be used at the top of any external XSLT stylesheet file
-->
<xsl:stylesheet
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
version="1.0"
exclude-result-prefixes="xsl msxsl ddwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:asp="http://schemas.microsoft.com/ASPNET/20"
xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:SharePoint="Microsoft.SharePoint.WebControls"
xmlns:ddwrt2="urn:frontpage:internal">
<xsl:output method="html" indent="no"/>
<!--
End of Set Up
-->

<table>
    <tr>
        <td>Title: <xsl:value-of select="@Title" /></td>
    </tr>

    <tr>
        <td>Name: <xsl:value-of select="@Name" /></td>
    </tr>
</table>

</xsl:stylesheet>
7
  • In case of I know XSLT, is it necessary develop code to just show data of the list? Nov 18, 2014 at 15:22
  • If you just want to display some list or library using XSLT then it is very easy. Just a few lines of code (not like in Visual Studio) and you can display in whatever layout you want. Unfortunately I don't have code right now (I am on a different PC) but I will see if I can find some. Nov 18, 2014 at 20:04
  • Added code above Nov 18, 2014 at 20:13
  • :) I referred to this. in at present I have a discussion of how build a webpart that just show data of a list, and I consider a waste of time make this with .Net code, when with XSLT It is simpler and more flexible. What do you think of this discussion? Nov 19, 2014 at 19:58
  • Depends on situation. If you just want to display a list or library in your own HTML style then XSLT is better. If you want to perform data manipulation or some complex operation then .Net is better. Nov 20, 2014 at 7:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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