0

是否可以使用名为 org.dita4publishers.html2 的插件从 html2 转换输出生成的输出中删除命名空间

我已经生成了从 dita 到 html2 的输出,我得到了 fig

我正在从 html2 转换中获取输出

<div xmlns="http://www.w3.org/1999/xhtml" class="fignone" id="call1">
<div class="figbody">
<img xmlns="" src="images/imag1.png"></img>
</div>
<span class="figcap"><span class="enumeration fig-enumeration">Figure 1. </span>Nursing image</span></div>

但我想像这样排除命名空间

<div class="fignone" id="call1">
<div class="figbody">
<img xmlns="" src="images/imag1.png"></img>
</div>
<span class="figcap"><span class="enumeration fig-enumeration">Figure 1. </span>Nursing image</span></div>

我正在使用模板生成 css 链接

<xsl:template match="*" mode="chapterHead">
   <head><xsl:value-of select="$newline"/>
     <!-- initial meta information -->
   <link rel="stylesheet" type="text/css" href="css/care.css"/><xsl:value-of select="$newline"/>
   </head>
   <xsl:value-of select="$newline"/>
 </xsl:template>

但是像这样生成输出

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

它忽略了/之前的文字,也忽略了/

我想要输出为

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

请就这些问题向我提出建议。

注意:我也使用了 exclude-result-prefixes="#all" 。但它不起作用。

提前致谢

4

1 回答 1

0

您对问题的描述不正确。就 XDM 数据模型而言,您不希望从输出中“删除名称空间”,您希望输出中的每个元素都位于与其当前所在的名称不同的名称空间中。(具体来说,您希望它不在命名空间中)。这会影响创建元素的每条指令。所以实现这一点的最简单方法可能是对当前输出进行后处理传递,使用模板规则更改命名空间

<xsl:template match="*">
  <xsl:element name="{local-name()}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>
于 2017-03-13T15:59:44.517 回答