# XSLT or .NET in a webpart

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 ?

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>

• In case of I know XSLT, is it necessary develop code to just show data of the list? – Andres Williams Nov 18 '14 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. – Frank Martin Nov 18 '14 at 20:04
• Added code above – Frank Martin Nov 18 '14 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? – Andres Williams Nov 19 '14 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. – Frank Martin Nov 20 '14 at 7:15