2009-06-03 3 views
0

XSL 파일을 사용하여 BDC 목록 웹 파트의 데이터베이스 열 이름을 변경하고 싶습니다.XSLT를 사용하여 Sharepoint BDC 웹 파트의 열 머리글 편집

My SQL 쿼리는 "Select BATCH_ID..."입니다. XSL을 사용하여 해당 열 이름을 "BATCH_ID"에서 "ID"으로 변경하고 싶습니다. $ColName_0의 값이 'BATCH_ID'으로 채워지는 것을 알고 싶습니까?

dvt.headerfield 템플릿 안에 정렬 메뉴가 정렬 및 추가됩니다. 그러나 템플릿이 호출되기 전에 $ColName_0이 채워집니다. XSLT 코드는 다음입니다 :

<xsl:stylesheet 
    version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" 
    xmlns:asp="http://schemas.microsoft.com/ASPNET/20" 
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
    xmlns:SharePoint="Microsoft.Sharepoint.WebControls" 
    exclude-result-prefixes="xsl msxsl ddwrt" 
> 
    <xsl:output method="xml" indent="yes"/> 
    <xsl:param name="dvt_partguid" /> 
    <xsl:param name="ColName_0"></xsl:param> 

    <xsl:template name="dvt.headerfield"> 
    <xsl:param name="fieldname" /> 
    <xsl:param name="fieldtitle" /> 
    <xsl:param name="displayname" /> 
    <xsl:param name="fieldtype">0</xsl:param> 

    <table CtxNum="1" cellspacing="0" class="ms-unselectedtitle" onmouseover="OnMouseOverAdHocFilter(this, '{concat($displayname,$fieldname, $fieldtype, $dvt_partguid)}')"> 
     <tr> 
     <td width="100%" class="ms-vb" nowrap=""> 
      <a> 
      <xsl:attribute name="href">javascript: <xsl:value-of select="ddwrt:GenFireServerEvent(('dvt_sortfield;dvt_sortdir'))" />;</xsl:attribute> 
      <xsl:value-of select="$fieldtitle"/> 
      </a>     
     </td> 
     <td> 
      <img src="/_layouts/images/blank.gif" width="13" style="visibility: hidden" alt="" /> 
     </td> 
     </tr> 
    </table> 
    </xsl:template> 

    <xsl:template match="/"> 
    <xsl:call-template name="dvt_1" /> 
    </xsl:template> 

    <xsl:template name="dvt_1"> 
    <xsl:variable name="dvt_StyleName">Table</xsl:variable> 

    <table id="BdwpRows" border="0" width="100%" cellpadding="2" cellspacing="0"> 
     <tr valign="top"> 
     <th class="ms-vh" width="1" /> 
     <th class="ms-vh" align="left"> 
      <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1"> 
      <xsl:with-param name="fieldname">@BATCH_ID</xsl:with-param> 
      <xsl:with-param name="fieldtitle"> 
       <xsl:value-of select="$ColName_0" /> 
      </xsl:with-param> 
      <xsl:with-param name="displayname"> 
       <xsl:value-of select="$ColName_0" /> 
      </xsl:with-param> 
      <xsl:with-param name="fieldtype">text</xsl:with-param> 
      </xsl:call-template> 
     </th> 
     </tr>   
    </table> 
    </xsl:template> 
</xsl:stylesheet> 
+0

당신이 게시 할 수를 xslt가 작동하기위한 몇 가지 샘플 xml? –

답변

0

를이 가장 좋은 방법이지만, 여기에 내가했던 방법은 확실하지 :

변경 :

<xsl:with-param name="fieldname">@BATCH_ID</xsl:with-param> 
    <xsl:with-param name="fieldtitle"> 
     <xsl:value-of select="$ColName_0" /> 
    </xsl:with-param> 
    <xsl:with-param name="displayname"> 
     <xsl:value-of select="$ColName_0" /> 
    </xsl:with-param> 
<xsl:with-param name="fieldtype">text</xsl:with-param> 

사람 :

<xsl:with-param name="fieldname">@BATCH_ID</xsl:with-param> 
    <xsl:with-param name="fieldtitle"> 
     ID 
    </xsl:with-param> 
    <xsl:with-param name="displayname"> 
     <xsl:value-of select="$ColName_0" /> 
    </xsl:with-param> 
<xsl:with-param name="fieldtype">text</xsl:with-param> 
관련 문제