简体   繁体   English

元素之间的XSL-FO空格

[英]XSL-FO whitespaces between elements

I'm using this code to make two-level numbering, like "1.1. Chapter One", for example. 我正在使用此代码进行两级编号,例如“ 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>

But I discovered that this code generates the following text: 但是我发现这段代码生成以下文本:

1. 1. Chapter One

- with a space between xsl:number elements. -xsl:number元素之间有一个空格。 And this is what I do not want to happen. 这就是我不想发生的事情。 I already have 我已经有了

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

but it does not help anything. 但这无济于事。

How do I get rid of these parasite spaces? 如何摆脱这些寄生虫空间?

set the periods . 设定期间. in xsl:text tag 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>

A simple way is to avoid the new-line outside of the tags as in: 一种简单的方法是避免在标记之外使用换行符,如下所示:

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

And you certainly do not need the <xsl:text> since you'll get a newline there. 而且您当然不需要<xsl:text>因为在那里您将获得换行符。 Although if you do not want a newline, again you can remove it like this: 尽管如果您不希望换行符,也可以像这样删除它:

<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