Xslt 通过XSL以斜体打印

Xslt 通过XSL以斜体打印,xslt,Xslt,我是语言学家,我刚刚开始了解这种语法。我想恢复名称本身,但如果ex中的任何内容都以斜体打印,我如何将其放在该表的第一列 这是XML: 标题 出版信息 关于来源的信息 卡皮图罗1号 这本书是一本开本专栏和一本书 诺姆布雷西托斯·阿方索·奥特罗·诺姆布雷西洛·帕拉诺·多尼亚 比阿特丽兹 卡皮图洛二世 这是卡皮图罗二世时期的一本书,是一本开本的哥伦布书。 你的名字是:阿方索老头子,乌拉卡老头子 卡皮图洛三世 这是卡皮图罗3号。Vamos a poner tres nombres: 费尔南多,莱蒂西

我是语言学家,我刚刚开始了解这种语法。我想恢复
名称本身
,但如果
ex
中的任何内容都以斜体打印,我如何将其放在该表的第一列

这是XML:


标题
出版信息

关于来源的信息

卡皮图罗1号 这本书是一本开本专栏和一本书 诺姆布雷西托斯·阿方索·奥特罗·诺姆布雷西洛·帕拉诺·多尼亚 比阿特丽兹 卡皮图洛二世 这是卡皮图罗二世时期的一本书,是一本开本的哥伦布书。 你的名字是:阿方索老头子,乌拉卡老头子 卡皮图洛三世 这是卡皮图罗3号。Vamos a poner tres nombres: 费尔南多,莱蒂西亚·伊萨

安特罗波尼莫斯
名义
利布罗
卡皮图罗
对开本
圆柱
利尼亚

一般来说,我建议为要转换的节点和要使用的
name type=“property”
元素设置模板,例如

<xsl:template match="tei:name[@type = 'proper']">
  <div>
    <xsl:apply-templates/>
  </div>
</xsl:template>
请记住,XSLT只是一种用于将XML转换为其他格式的编程语言,因此它不是XSLT确定任何斜体或其他呈现方式,它只是用于生成所需的输出,在您的示例中,它似乎是HTML,其中
em
元素应该给予强调。您也可以选择使用CSS。但是,如果要转换为PDF,则需要使用XSLT生成正确的XSL-FO元素和所需的属性

一个更完整的例子是

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:tei="http://www.tei-c.org/ns/1.0"
    exclude-result-prefixes="tei">
    <xsl:output method="html" version="5.0" doctype-system="about:legacy-comapat"/>
    <xsl:template match="/">
        <html lang="es">
            <head>
            </head>
            <body>
                <h3 align="center">
                    <b>Antropónimos</b>
                </h3>
                <table width="750" border="1" align="center">
                    <thead>
                        <tr>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Nombre</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Libro</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Capítulo</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Folio</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Columna</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Línea</div>
                            </th>
                        </tr>                        
                    </thead>
                    <tbody>
                        <xsl:apply-templates select="//tei:name[@type = 'proper']"/>
                    </tbody>
                </table>
            </body>
        </html>

    </xsl:template>

    <xsl:template match="tei:name[@type = 'proper']">
        <tr>
            <td>
                <xsl:apply-templates/>
            </td>
            <td>
                <xsl:value-of select="ancestor::tei:div1/@n"/>
            </td>
            <td>
                <xsl:value-of select="ancestor::tei:div2/@n"/>
            </td>
            <td>
                ...
            </td>
            <td>
                ...
            </td>
            <td>
                ...
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="tei:name[@type = 'proper']/tei:ex">
        <em>
            <xsl:apply-templates/>
        </em>
    </xsl:template>

</xsl:stylesheet>

安特罗波尼莫斯
名义
利布罗
卡皮图罗
对开本
圆柱
利尼亚
...
...
...

非常感谢您的回答。这当然是非常完整的。很抱歉再次打扰你。我正在努力,但我不知道我到底要在表中添加什么,您给我发送了什么。。。抱歉@MartinHonnet整个任务我不清楚,因为您似乎有几个列,但在每个列中使用相同的
。我用转换
tei:ex
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:tei="http://www.tei-c.org/ns/1.0"
    exclude-result-prefixes="tei">
    <xsl:output method="html" version="5.0" doctype-system="about:legacy-comapat"/>
    <xsl:template match="/">
        <html lang="es">
            <head>
            </head>
            <body>
                <h3 align="center">
                    <b>Antropónimos</b>
                </h3>
                <table width="750" border="1" align="center">
                    <thead>
                        <tr>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Nombre</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Libro</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Capítulo</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Folio</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Columna</div>
                            </th>
                            <th scope="col" bgcolor="#00CCFF">
                                <div align="center">Línea</div>
                            </th>
                        </tr>                        
                    </thead>
                    <tbody>
                        <xsl:apply-templates select="//tei:name[@type = 'proper']"/>
                    </tbody>
                </table>
            </body>
        </html>

    </xsl:template>

    <xsl:template match="tei:name[@type = 'proper']">
        <tr>
            <td>
                <xsl:apply-templates/>
            </td>
            <td>
                <xsl:value-of select="ancestor::tei:div1/@n"/>
            </td>
            <td>
                <xsl:value-of select="ancestor::tei:div2/@n"/>
            </td>
            <td>
                ...
            </td>
            <td>
                ...
            </td>
            <td>
                ...
            </td>
        </tr>
    </xsl:template>

    <xsl:template match="tei:name[@type = 'proper']/tei:ex">
        <em>
            <xsl:apply-templates/>
        </em>
    </xsl:template>

</xsl:stylesheet>