Thursday, May 9, 2013

XPath syntax for SharePoint list form

Had a customer who wanted to modify the standard display for a sharepoint list view.
Using SharePoint Designer, updated the xml using the following XPath syntax.

Customer wanted the contents of the list column 'My Field' which contained an the user's email address which linked to the list entry to create an email message.  This was done by parsing out the email address from the entry which looked like

sample
<a href="listcontent.aspx?id=1">myemail@domain.com</a>

customer wanted
<a href="mailto:myemail@domain.com">myemail@domain.com</a>

XPath syntax created desired results:

<a href="mailto:{substring-before(substring-after(@My_x0020_Field, &quot;sip='&quot;),&quot;'id=&quot;)}?subject={concat(@Title, '-',@My_x0020_Field)}">
<xsl:value-of select="substring-before(substring-after(@My_x0020_Field,'&#34;&gt;'),'&lt;/A')" />
</a>

Legend:
&quot; = "
&#34; = "
&gt; = >
&lt; = <

No comments:

Post a Comment