I’ve been doing a bit of XSL stuff lately and thought I’d put together a sample for my future reference and that may be of value to all of us XSLT-ers making a living in the internets.
Consider the following XML:
<FdcSearchTabsCollection Count="2">
<SearchTab Label="Industry" SortOrder=”00” Label=”Industries” SearchConstraints="contenttype:Industry" TabID="831b2a74-98c4-4453-8061-86e2fdb22c63"/>
<SearchTab Label="Practices" SortOrder=”01” Label=”Practices” SearchConstraints="contenttype:PracticeGroups" TabID="678e206b-6996-421f-9765-b0558fe1a9c0"/>
</FdcSearchTabsCollection>
The following XSL snippet will generate a sorted list of hrefs tabs:
<קססל:template match="FdcSearchTabsCollection" קסמל:space="preserve">
<!– The "all" tab –>
<a href="javascript:ViewTab(‘All’)">View all</אַ>
<!– Each individual tab –>
<!– Iterate through all the Tabs and display the correct לינקס. –>
<קססל:for-each select="SearchTab">
<קססל:sort select="@SortOrder"/>…
<a href="javascript:ViewTab('{@TabID}')"><קססל:value-of select="@Label"/></אַ>
</קססל:פֿאַר, יעדער><בר />
</קססל:מוסטער>
Here’s what it looks like in SharePoint:
</עק>
גיי מיר אויף טוויטטער בייַ http://www.twitter.com/pagalvin
היי, פאולוס. Interesting that the XML isn’t valid, as each SearchTab element has two Label attributes. Please tell me that SharePoint doesn’t generate that!
ב.