gpt4 book ai didi

javascript - 如何在 XSLT 中包含 CSS 文件

转载 作者:太空宇宙 更新时间:2023-11-03 17:43:25 24 4
gpt4 key购买 nike

所以我有一个如下所示的 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 中粗体和斜体可以正常工作。

实际上我正在将 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 中,它显示如下图

enter image description here

并且在转换为 Word 格式后,BOLD(Character) 将无法像下图那样工作

enter image description here

我错在哪里?

最佳答案

我看不出问题出在哪里。

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

关于javascript - 如何在 XSLT 中包含 CSS 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28697342/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com