Question

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 ?

Était-ce utile?

La solution

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>
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top