簡體   English   中英

如何在XSLT中包括CSS文件

[英]How to include CSS file in the XSLT

所以我有一個如下的CSS文件

.table_class1DeffCell
{
border-top-width : 1;
border-left-width : 1;
border-right-width : 1;
border-bottom-width : 1;
}
.table_class11DeffCell
{
border-bottom-color : 000000;
border-top-color : 000000;
border-right-color : 000000;
border-left-color : 000000;
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
border-bottom-style : solid;
border-top-width : 1;
border-left-width : 1;
border-right-width : 1;
border-bottom-width : 1;
}
.table_class24DeffCell
{
border-bottom-color : 000000;
border-top-color : 000000;
border-right-color : 000000;
border-left-color : 000000;
border-top-style : solid;
border-left-style : solid;
border-right-style : solid;
border-bottom-style : solid;
border-top-width : 1;
border-left-width : 1;
border-right-width : 1;
border-bottom-width : 1;
}

.text_class40
{
font-style : italic;
}

.text_class41
{
font-weight : bold;
}

.image_class42
{
}

在HTML中,其鏈接如下所示

<link rel="stylesheet" type="text/css" href="FormatingProblem.css"></link>

由於鏈接了CSS文件,因此HTML BOLD和Italics中的正確工作。

實際上,如果我無法做這些粗體和斜體字,我正在將HTML文件轉換為Word文檔。

這是我的XSLT文件

 <table width="100%">
            <tr>
              <xsl:if test="@class=$TableClass">
                <!--left Table Cell-->
                <xsl:choose>
                  <!--Requirement-->
                  <xsl:when test="td[@class=$RequirementType]/span/span/. = 'Non Functional' or td[@class=$RequirementType]/span/span/. = 'Functional' or td[@class=$RequirementType]/span/span/. = 'Scenario' or td[@class=$RequirementType]/span/span/. = 'Actor'">
                    <td style="border-Top: black 1.0pt solid; border-Bottom: #4896a black 1.0pt solid; vertical-align:'top'" bgcolor = "#DDD9C3" width="80%">
                      <!--Text-->
                      <xsl:if test="td/@class=$Requirements">
                        <xsl:for-each select="td[@class=$Requirements]/span/span | td[@class=$Requirements]/span/br | td[@class=$Requirements]/span/blockquote">
                          <span>
                            <xsl:if test="name() != 'br'">
                              <xsl:value-of select="." />
                              <xsl:if test="name() = 'blockquote'">
                                <br/>
                              </xsl:if>
                            </xsl:if>
                            <xsl:if test="name() = 'br'">
                              <br/>
                            </xsl:if>

                          </span>
                        </xsl:for-each>
                      </xsl:if>
                      <br />
                      <br />
                      <!--Reference-->
                      <xsl:if test="td/@class=$References">
                        <xsl:if test="string-length(td[@class=$References]/span/span)!=0">
                          <span>
                            <br />
                            <xsl:for-each select="td[@class=$References]/span/span | td[@class=$References]/span/br">
                              <span>
                                <xsl:if test="name() != 'br'">
                                  <xsl:value-of select="." />
                                </xsl:if>
                                <xsl:if test="name() = 'br'">
                                  <br/>
                                </xsl:if>
                              </span>
                            </xsl:for-each>
                          </span>
                        </xsl:if>
                      </xsl:if>
                      <br />
                      <br />
                    </td>
                  </xsl:when>
                </xsl:choose>
                <!--right Table Cell-->
                <xsl:choose>
                  <!--Requirement-->
                  <xsl:when test="td[@class=$RequirementType]/span/span/. = 'Functional' or td[@class=$RequirementType]/span/span/. = 'Non Functional' or td[@class=$RequirementType]/span/span/. = 'Scenario' or td[@class=$RequirementType]/span/span/. = 'Actor'">
                    <xsl:choose>
                      <!--Search 1-->
                      <xsl:when test="td[@class=$Auxiliary]/span[contains(span, $search1)]">
                        <td style="vertical-align:'top'" bgcolor="{$search1Color}" width="20%">
                          <span style="font-size:8pt">
                            <!--UID_ATR-->
                            <xsl:if test="td/@class=$UID">
                              ID:
                              <xsl:value-of select="td[@class=$UID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_ID-->
                            <xsl:if test="td/@class=$TFS_ID">
                              TFS:
                              <xsl:value-of select="td[@class=$TFS_ID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Triage-->
                            <xsl:if test="td/@class=$Triage">
                              <xsl:value-of select="td[@class=$Triage]/." />
                            </xsl:if>
                            <br />
                            <!--V. In-->
                            <xsl:if test="td/@class=$V.In">
                              <xsl:value-of select="td[@class=$V.In]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Priority-->
                            <xsl:if test="td/@class=$Priority">
                              (Prio
                              <xsl:value-of select="td[@class=$Priority]/." />)
                            </xsl:if>
                            <br />
                            <!--TFS_Requirement Type-->
                            <xsl:if test="td/@class=$RequirementType">
                              <xsl:value-of select="td[@class=$RequirementType]/." />
                            </xsl:if>
                            <br />
                            <br />
                            <!--Auxiliary-->
                            <xsl:if test="td/@class=$Auxiliary">
                              <xsl:value-of select="td[@class=$Auxiliary]/." />
                              <br />
                            </xsl:if>
                            <br />
                          </span>
                        </td>
                      </xsl:when>
                      <!--Search 2-->
                      <xsl:when test="td[@class=$Auxiliary]/span[contains(span, $search2)]">
                        <td style="vertical-align:'top'" bgcolor="{$search2Color}" width="20%">
                          <span style="font-size:8pt">
                            <!--UID_ATR-->
                            <xsl:if test="td/@class=$UID">
                              ID:
                              <xsl:value-of select="td[@class=$UID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_ID-->
                            <xsl:if test="td/@class=$TFS_ID">
                              TFS:
                              <xsl:value-of select="td[@class=$TFS_ID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Triage-->
                            <xsl:if test="td/@class=$Triage">
                              <xsl:value-of select="td[@class=$Triage]/." />
                            </xsl:if>
                            <br />
                            <!--V. In-->
                            <xsl:if test="td/@class=$V.In">
                              <xsl:value-of select="td[@class=$V.In]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Priority-->
                            <xsl:if test="td/@class=$Priority">
                              (Prio
                              <xsl:value-of select="td[@class=$Priority]/." />)
                            </xsl:if>
                            <br />
                            <!--TFS_Requirement Type-->
                            <xsl:if test="td/@class=$RequirementType">
                              <!--Zeilenumbruch-->
                              <xsl:value-of select="td[@class=$RequirementType]/." />
                            </xsl:if>
                            <br />
                            <br />
                            <!--Auxiliary-->
                            <xsl:if test="td/@class=$Auxiliary">
                              <xsl:value-of select="td[@class=$Auxiliary]/." />
                              <br />
                              <!--Zeilenumbruch-->
                            </xsl:if>
                            <br />
                          </span>
                        </td>
                      </xsl:when>
                      <!--No Search-->
                      <xsl:otherwise>
                        <td style="vertical-align:'top'" width="20%">
                          <span style="font-size:8pt">
                            <!--UID_ATR-->
                            <xsl:if test="td/@class=$UID">
                              ID:
                              <xsl:value-of select="td[@class=$UID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_ID-->
                            <xsl:if test="td/@class=$TFS_ID">
                              TFS:
                              <xsl:value-of select="td[@class=$TFS_ID]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Triage-->
                            <xsl:if test="td/@class=$Triage">
                              <xsl:value-of select="td[@class=$Triage]/." />
                            </xsl:if>
                            <br />
                            <!--V. In-->
                            <xsl:if test="td/@class=$V.In">
                              <xsl:value-of select="td[@class=$V.In]/." />
                            </xsl:if>
                            <br />
                            <!--TFS_Priority-->
                            <xsl:if test="td/@class=$Priority">
                              (Prio
                              <xsl:value-of select="td[@class=$Priority]/." />)
                            </xsl:if>
                            <br />
                            <!--TFS_Requirement Type-->
                            <xsl:if test="td/@class=$RequirementType">
                              <xsl:value-of select="td[@class=$RequirementType]/." />
                            </xsl:if>
                            <br />
                            <br />
                            <!--Auxiliary-->
                            <xsl:if test="td/@class=$Auxiliary">
                              <xsl:value-of select="td[@class=$Auxiliary]/." />
                              <br />
                              <!--Zeilenumbruch-->
                            </xsl:if>
                            <br />
                          </span>
                        </td>
                      </xsl:otherwise>
                    </xsl:choose>
                  </xsl:when>
                  <!--No Requirement-->
                  <xsl:otherwise>
                    <span width="20%"></span>
                  </xsl:otherwise>
                </xsl:choose>
              </xsl:if>
            </tr>
          </table>

在HTML中,其顯示如下圖所示

在此處輸入圖片說明

並且轉換為Word格式后, 粗體 (字符)將無法像下面的圖像一樣工作

在此處輸入圖片說明

我在這方面做錯了什么?

我看不出問題出在哪里。

<xsl:template match="/">
  <html>
    <head>
      <link rel="stylesheet" type="text/css" href="FormatingProblem.css" />
    </head>
    <body>
      <xsl:apply-templates />
    </body>
  </html>
</xsl:template>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM