title: Use XSL to define indenting for specific elements
body: <p>I am writing an XSL which creates an XSL-FO that contains some literary references. One problem I have encountered is in properly treating the triple em dash in references. When the same author is repeated in two sequential references, a triple em dash is used in place of the author's name in the second reference. The em dashes should be closed up. </p>
  
  <p>The XSL-FO method I have found for achieving this is by using fo:character in place of the em dashes, with a negative letter spacing. Unfortunately, when I output the FO, each fo:character element is placed on its own line, which I think the FO processor interprets as white space. So my em dashes end up spaced out. If I go into the FO and put them on the same line, they look as they should.</p>
  
  <p>The easy solution to my problem is to set the indent attribute of xsl:output to no. However, my FO file is very long and that makes it unreadable. I'm wondering if there is any other method for forcing indent rules on specific elements. (I'm open to another method of handling this in XSL-FO, but I understand that should be a different SO question).</p>
  
  <p>Here is the template that adds the fo:character tags.</p>
  
  <pre><code>&lt;xsl:template match="ref/text()[matches(., '^———.')]"&gt;
      &lt;fo:character character="—" letter-spacing="-.2em"/&gt;&lt;fo:character character="—" letter-spacing="-.2em"/&gt;&lt;fo:character character="—" letter-spacing="-.2em"/&gt;&lt;xsl:copy-of select="substring-after(., '———')"/&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>Sample short XML:</p>
  
  <pre><code>&lt;document&gt;
      &lt;ref&gt;———. &lt;i&gt;Hamlet&lt;/i&gt;. Ed. Harold Jenkins. London: Methuen, 1982. Print.&lt;/ref&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>Snippet of the output that I get with indent="yes":</p>
  
  <pre><code>&lt;fo:block start-indent="11pt"
          text-indent="-11pt"&gt;
      &lt;fo:character character="—" letter-spacing="-.2em"/&gt;
      &lt;fo:character character="—" letter-spacing="-.2em"/&gt;
      &lt;fo:character character="—" letter-spacing="-.2em"/&gt;. &lt;fo:inline font-style="italic"&gt;Hamlet&lt;/fo:inline&gt;. Ed. Harold Jenkins. London: Methuen, 1982. Print.&lt;/fo:block&gt;
  </code></pre>
  
  <p>I'm using XSL 2.0 and Saxon-HE. Is conditional indenting possible, or should I find another solution?</p>