<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:template match="FieldRef[@FieldType='SPHyperlinkField']" mode="URL_body" >
<xsl:param name="thisNode" select="."></xsl:param>

<xsl:variable name="url" select="substring-before($thisNode/@*[name()=current()/@Name],',')"></xsl:variable>
<xsl:variable name="desc" select="$thisNode/@*[name()=concat(current()/@Name, '.desc')]"></xsl:variable>
<xsl:variable name="attr" select="substring-before($thisNode/@*,',')"></xsl:variable>
<a href="{$url}" target="_blank">
<xsl:value-of select="$desc"/>
</a>
thisNode:
<xsl:for-each select="$thisNode/@*">
<xsl:value-of select="name(.)"/>
=
<xsl:value-of select="." disable-output-escaping="yes"/>
<br/>
</xsl:for-each>
<hr/>
currentField
<xsl:for-each select="current()/@*">
<xsl:value-of select="name(.)"/>
=
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet> 

 

//原样输入xml

<xsl:copy-of select="current()"/>

//for view xsl:

<xsl:copy-of select="$XmlDefinition"/>

 

//for lookup field:

 <xsl:template match="FieldRef[@FieldType='DeptField']" priority="1" mode="Lookup_body" >

ref:http://stackoverflow.com/questions/2929118/custom-xsl-rendering-for-lookup-field-in-list-view-sharepoint-2010

posted on 2013-07-29 12:43  jianyi  阅读(347)  评论(0)    收藏  举报