更改字体粗细

时间:2012-02-21 12:04:41

标签: xslt sharepoint-2010

我对xsl非常新,有点迷失......

如果满足条件,如何只更改字段行的字体粗细?该条件基于多选字段。我怎样才能得到合适的价值?使用contains()方法?

你能举个例子吗?

提前致谢!

编辑1。

<XmlDefinition>
            <View Name="{F8A953EA-F74C-4F70-99C2-2239531D137E}" MobileView="TRUE" MobileDefaultView="TRUE" Type="HTML" DisplayName="Tous les mails" Url="/Dossier/Forms/Tous.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/dlicon.png">
                <Query>
                    <OrderBy>
                        <FieldRef Name="Date" Ascending="FALSE"/>
                    </OrderBy>
                </Query>
                <ViewFields>
                    <FieldRef Name="DocIcon"/>
                    <FieldRef Name="LinkFilenameNoMenu"/>
                    <FieldRef Name="Type"/>
                    <FieldRef Name="Dossier"/>
                    <FieldRef Name="Dossier_x003a_N_x00b0__x002f_Dossier"/>
                    <FieldRef Name="Date"/>
                    <FieldRef Name="EmailSender"/>
                    <FieldRef Name="EmailTo"/>
                    <FieldRef Name="EmailCc"/>
                    <FieldRef Name="FileSizeDisplay"/>
                    <FieldRef Name="CaThermique"/>
                    <FieldRef Name="etat_ca_chauffage"/>
                    <FieldRef Name="CaElectricite"/>
                    <FieldRef Name="etat_ca_electricite"/>
                    <FieldRef Name="Notifie_a"/>
                    <FieldRef Name="Created"/>
                    <FieldRef Name="Author"/>
                    <FieldRef Name="Dossier_x003a_lien_dossier"/>
                    <FieldRef Name="EmailSubject"/>
                </ViewFields>
                <RowLimit Paged="TRUE">30</RowLimit>
                <Aggregations Value="Off"/>
                <ViewStyle ID="17"/>
                <Toolbar Type="Standard"/>
            </View>
        </XmlDefinition>

编辑2。

<xsl:template match="FieldRef[@Name='LinkFilenameNoMenu']" name="LinkFilenameNoMenu.LinkFilenameNoMenu" mode="Computed_LinkFilename_body" ddwrt:tag="a" ddwrt:dvt_mode="body" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
      <xsl:param name="thisNode" select="."/>
      <xsl:param name="ShowAccessibleIcon" select="0"/>
      <xsl:param name="folderUrlAdditionalQueryString"/>
      <xsl:param name="IncludeOnClick" select="1"/>
      <div class="ligneBellucci">
      <a onfocus="OnLink(this)" href="{$thisNode/@FileRef}" onmousedown="return VerifyHref(this,event,'{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@serverurl.progid}')"
           onclick="return DispEx(this,event,'TRUE','FALSE','{$thisNode/@File_x0020_Type.url}','{$thisNode/@File_x0020_Type.progid}','{$XmlDefinition/List/@DefaultItemOpen}','{$thisNode/@HTML_x0020_File_x0020_Type.File_x0020_Type.mapcon}','{$thisNode/@HTML_x0020_File_x0020_Type}','{$thisNode/@serverurl.progid}','{$thisNode/@CheckoutUser.id}','{$Userid}','{$XmlDefinition/List/@ForceCheckout}','{$thisNode/@IsCheckedoutToLocal}','{$thisNode/@PermMask}')">
          <xsl:value-of disable-output-escaping="yes" select="$thisNode/@EmailSubject" />               
    </a>
      </div> 
       <xsl:if test="$thisNode/@Created_x0020_Date.ifnew='1'">
        <xsl:call-template name="NewGif.LinkFilenameNoMenu">
          <xsl:with-param name="thisNode" select="$thisNode"/>
      </xsl:call-template>          
      </xsl:if>

基本上,如果“etat_ca_chauffage”等于某个值,则所有字段都应以粗体显示...

1 个答案:

答案 0 :(得分:0)

E.g。

<xsl:template match="**YOUR CONDITION GOES HERE **">
    <xsl:apply-templates select="@*"/>
    <xsl:attribute name="font-weight">bold</xsl:attribute>
    <xsl:apply-templates select="*"/>
</xsl:template>

<xsl:template match="@* | node()">
    <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>