header

Quickly Manipulate Multiple HTML Tags/Blocks With SharePoint Designer 2010

Posted by Elio Struyf on 23/01/2012.

 

When working with master pages and page layouts in SharePoint Designer, you sometimes need to manipulate multiple HTML tags/blocks at once.

SharePoint Designer 2010 has a very useful HTML tags manipulator which can be found in the Find and Replace.

Find and Replace 

 The actions that can be performed to the HTML tags are the following:

  • Replace tag and contents;
  • Replace contents only;
  • Add after start tag;
  • Add after end tag;
  • Add before start tag;
  • Add before end tag;
  • Remove tag and contents;
  • Remove tag;
  • Change tag;
  • Set attribute value;
  • Remove attribute.

How it works

In this example I will remove all the SharePoint 2007 related content from the v4.master, these can be found by the following tags: <SharePoint:UIVersionedContent UIVersion="3" runat="server"></SharePoint:UIVersionedContent>. 

 

  • First you need to give up a HTML tag: SharePoint:UIVersionedContent;
  • In the Replace action menu, select: Remove tag and contents;
  • Click on the HTML Rules… button, this opens a new window; HTML Rules 
  • Click on New rule…, this will enable you to give up some search criteria for the HTML tags. One of the search criteria could be an attribute from the tag, in this case the UIVersion attribute can be used;
  • Create a rule so that the UIVersion attribute equals the value 3HTML Rules 
  • Click Ok;

Right now you can remove all the tags and its contents by clicking on the Replace All button.

Find and Replace Result 

Leave your comment

Name
E-mail
Comment
Captcha