繁体   English   中英

元素之间的XSL-FO空格

[英]XSL-FO whitespaces between elements

我正在使用此代码进行两级编号,例如“ 1.1。第一章”。

    <fo:inline>
      <xsl:number from="Book" count="Chapter"/>.
      <xsl:number from="Chapter" count="Chapter"/>.
      <xsl:text> </xsl:text>
      <xsl:apply-templates select="....."/>
    </fo:inline>

但是我发现这段代码生成以下文本:

1. 1. Chapter One

-xsl:number元素之间有一个空格。 这就是我不想发生的事情。 我已经有了

<xsl:strip-space elements="*"/>

但这无济于事。

如何摆脱这些寄生虫空间?

设定期间. xsl:text标签中

<fo:inline>
  <xsl:number from="Book" count="Chapter"/><xsl:text>.</xsl:text>
  <xsl:number from="Chapter" count="Chapter"/><xsl:text>.</xsl:text>
  <xsl:text> </xsl:text>
  <xsl:apply-templates select="....."/>
</fo:inline>

一种简单的方法是避免在标记之外使用换行符,如下所示:

<fo:inline>
  <xsl:number from="Book" count="Chapter"/>.<xsl:number
              from="Chapter" count="Chapter"/>.
  <xsl:apply-templates select="....."/>
</fo:inline>

而且您当然不需要<xsl:text>因为在那里您将获得换行符。 尽管如果您不希望换行符,也可以像这样删除它:

<fo:inline>
  <xsl:number from="Book" count="Chapter"/>.<xsl:number
              from="Chapter" count="Chapter"/>. <xsl:apply-templates
              select="....."/>
</fo:inline>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM