将 xml 导入 adobe indesign 时对标签应用粗体斜体字符样式

Apply bold italic character style to tag when importing xml to adobe indesign

是否可以在 adobe indesign 中将粗体斜体字符样式应用于标签。 目前您可以创建字符样式,例如'strong' 并将此样式映射到标签,因此当您导入 xml 时,'strong' 字符样式将应用于任何 'strong' 标签。

但是,如果您要创建新的字符样式,例如粗体斜体,你怎么能把它应用到标签上?目前,如果您要导入以下内容

<strong><em>I like cake!</em></strong>

并且您为 strong 和 em 定义了字符样式,只有 em 字符样式将被应用,因为 xml 树节点如下所示:

是否可以对 <strong><em> 应用粗体斜体字符样式,使其不只是斜体?

下面将为您提供一个 "emstrong" 标签,用于 em 嵌套在 strong 中,反之亦然。

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">

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

    <xsl:template match="em[../../strong]|strong[../../em]">
        <xsl:element name="emstrong">
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>