Hot answers tagged

24

I expect you have "BaseViewID" attribute set to "0" on the "View" element of your custom list definition. You should change this attribute to some other value (in range 1..255) and the problem should vanish then. Although this is actually all you need to solve the issue, I anticipate you might want some more detailed explanations :) Actually, BaseViewID is ...


11

You can use ParameterBindings to this purpose. <ParameterBinding Name="Language" Location="Resource(wss,language_value)" /> This will return "en-us" for English locale in xsl:param "Language". Also, you can pass whole resource values this way. You can read more about this in Stefan Stanev's blog: http://stefan-stanev-sharepoint-blog.blogspot.com/...


8

Actually you don't need to modify the OOTB files. In fact, it's a very bad idea, since Microsoft doesn't support modifying any of OOTB files in Layouts directory, except of DocIcon.xml. Any cumulative update or SharePoint service pack can replace these files, so your customizations will vanish in one moment. What you need to do, is to create your own file, ...


8

I'm not sure if XSLT 1.0 have today's date method. However, XSLT 2.0 has an equivalent current-date() Have you tried? ddwrt:Today() <xsl:value-of select="ddwrt:Today()"/> ddwrt:TodayIso() <xsl:value-of select="ddwrt:FormatDateTime(ddwrt:Today(),1033,'yyyyMMdd')"/>


8

When you add a DVWP to the page in SharePoint Designer, SPD defined a variable which contains the current date for you in the ParameterBindings section: <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/> Be sure to declare Today as a param at the top of the stylesheet: <xsl:param name="Today" /> Then you can ...


8

It depends on what you want to do with it. The power of using JSLink is that it uses JavaScript and runs in the client and you can use all the powerfull JavaScript libraries and for its easy to debug. It is easy to change the fields appearing and add some nice functionality to views. The weakness however is that JSLink runs in the client and it depends ...


7

You can filter list by using CAML and DaysOffset attribute of the Today tag. This can be done even from GUI. For example, this filter will narrow the shown items of a list view to those, which have Due date within a week from the current date: (List Tools => List => Modify view on the contextual ribbon) In terms of CAML, this will produce the following ...


7

There are just a few easy steps to follow in order to customise you blog page, the best way is to edit the blog.xsl file responsibl of rendring the blog posts. The standard SharePoint 2010 default page looklike : Assuming that you have already created a blog site, let's go to the 14 hive of your server and edit the blog.xsl file. C:\Program Files\Common ...


6

Use the following URL to get XML of list:- http://{0}/_vti_bin/owssvr.dll?Cmd=Display&List={1}&XMLDATA=TRUE {0} – The URL to your site. This could be the root web or a child site. {1} – The GUID for your list. To find the GUID for a list, just go to the Settings page for the list and copy it from the URL. Use the following URL to get XML of ...


5

There's an attribute you add to xsl:value-of called "disable-output-escaping". So change your line to look like this: <xsl:value-of select="@MyColumn" disable-output-escaping="yes"/>


5

When you change a page in SPD, it becomes customized (unghosted). Thus, GhostedXslLink no longer works. More details about ghosted and unghosted pages here: http://www.etechplanet.com/blog/ghosted-and-unghosted-pages-in-sharepoint.aspx You should use XslLink property instead of GhostedXslLink for unghosted pages. Just change it in the property editor in ...


5

PROBLEM SOLVED :-) :-) The bug of trying to set the xsllink property through the template seems to be a recognised bug. I'm even sure MS are aware of this as when looking at how they have created their site definitions it seems pretty uninstinctive. The Solution DO NOT SET OR DEFINE THE XSLTLISTVIEWWEBPART IN THE TEMPLATE instead just define a webpart ...


4

Use the xsl:choose block, with an xsl:if test to see if your URL is empty or not. something like this: <xsl:choose> <xsl:when test="string-length($urlField) = 0"> // do stuff </xsl:when> <xsl:otherwise> // show nothing </xsl:otherwise> </xsl:choose>


4

Managed to get it working - had to do this in the XSL: <script language="javascript" defer="true"> <xsl:comment> <![CDATA[ $(document).ready( function() { alert('boo'); }); ]]> </xsl:comment> </script>


4

Don't be afraid of XSLT. This is going to give you a tremendous amount of power without having to develop or deploy anything in return for a little effort to understand it. I always recommend starting with an identity transform so that you can see the XML that is coming in, and then start adding templates to process the nodes you are interested in. Visual ...


4

After looking for ages for the answer to this I stumbled on it minutes after posting this question... Anyway, the answer is here: http://blogs.msdn.com/b/joshuag/archive/2009/03/25/custom-date-formats-in-sharepoint-xsl.aspx Summary: Reference the ddwrt namespace at the top of the itemstyle.xls xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/...


4

I am adding this so that others who stumble accross it might find it useful. I got this to work by adding a __redirect to the GenFireServerEvent like this: onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={WhateverPage.aspx?IsDlg=5'})" Then on this page add something like this: _spBodyOnLoadFunctionNames.push("closeme"); function ...


4

When you expand the group, the listview webpart does callback(and not postback) to retrieve the data. While callback, the value of url parameter is not passed (unless you set a default value) and so you don't see data. To make it work : 1) Right click webpart 2) Go to webpart properties 3) Under "Ajax Options", Check "Enable Asynchronous update" 4) Click ...


4

The format of the Image with formatting and constraints for publishing is already with the image HTML tags. Ex.: <img alt="" src="Docs/Image.png" style="border: 0px solid" /> So you could try to do the following: <xsl:value-of select="substring-before(substring-after(@ImageField, 'src=&quot;'), '&quot; style')" />


4

Are you just doing this on a field by field basis? If so then you can override the rendering template for a particular field using fldtypes.xsl files. Drop these into templates/layouts/xsl and they magically work. So if you had a custom field called MyBigField, you can define an XSL just for displaying that field value in a list. More info here:- http://...


4

See if this helps: <xsl:for-each select="rows\row"> <li> <a> <xsl:attribute name="href"> <xsl:value-of select="{@FileURL}" /> </xsl:attribute> <xsl:attribute name=...


4

In order to define Custom Rendering for a SPFieldChoice in template for mode attribute should be used value body For example, if we apply for Tasks list that contains Status field (SPFieldChoice) the following XSLT style sheet <xsl:template match ="FieldRef[@Name='Status']" mode="body"> <xsl:param name="thisNode" select="."/> <xsl:...


4

You don't need to manipulate the web part settings manually in the code. These settings are also available on the ribbon. Select the DVWP in SharePoint Designer 2010 in Design View and then use the Paging command on the Options ribbon of the Data View Tools:


4

Just replace 2057 with 1036 (the LCID of fr-FR) and it should render the date in a French format. The possible values for the third parameter, which control what type of date string is rendered, are listed in the MSDN blog post “Custom Date Formats in SharePoint XSL”.


3

You'll need to use the Xsl:If function to ascertain whether or not the banner has anything in it to display. In the example below, I'm just testing the $SafeImageUrl variable that the content query webpart supplies out of the box. <xsl:if test="string-length($SafeImageUrl) !=0"> <img class="image" src="{$SafeImageUrl}" title="@ImageUrlAltText">&...


3

The ID won't be there. You'll need to look up the value in the source list to get at the ID: <xsl:variable name="LookupID" select="/dsQueryResponse/List2/Rows/Row[@Title = current()/@ColumnX]"/>


3

Marc Anderson has a blog post that covers stripping HTML from rich text fields to display the first n number of characters of a field. You can probably use a portion of his post to accomplish what you're looking to do: http://mdasblog.wordpress.com/2009/01/20/displaying-the-first-n-words-of-a-long-text-column-with-xsl/


3

I found out that there's no need to encode a parameter using ddwrt:UrlEncode. So the code on the first page becomes: 1) Building the URL <xsl:variable name="MyURL" select="concat('../../Lists/MyList/MyView.aspx?ID=',@ID,'&amp;MyName=', @Title)" /> 2) Creating a hyperlink <a onclick="GoToLink(this); return false;" target="_self"> <...


3

This should work: <xsl:value-of select="sum($Rows[string-length(@Distance) &gt; 0]/@Distance)" /> M.


3

At first glance, you are closing off your xsl param in the first line. Then you have an unnecessary and mistyped closing xsl param tag which can be removed. You'll also want to include an xsl:otherwise so that if no multiple selection is made, the text is returned. This might be helpful, look at question 1. You'll need to do a recursive template to do it,...



Only top voted, non community-wiki answers of a minimum length are eligible