steguozzo
steguozzo

Reputation: 55

XSLT 2.0 preserve space after element

I have a xml file like this:

<p>Consideriamo una retta che passa per i punti <em>P</em><sub>1</sub> di coordinate (<em>x</em><sub>1</sub>; <em>y</em><sub>1</sub>). </p><ul><li>text...</li><li>Other...</li></ul>

I need to transform (with xslt Saxon PE) indent in only block elements, not the inline elements, something like:

<p>Consideriamo una retta che passa per i punti <em>P</em><sub>1</sub> di coordinate (<em>x</em><sub>1</sub>; <em>y</em><sub>1</sub>). </p>
<ul>
  <li>text...</li>
  <li>Other...</li>
<ul>

Upvotes: 1

Views: 111

Answers (2)

Michael Kay
Michael Kay

Reputation: 163498

If you run with schema validation on the result document (which would need Saxon-EE), then indent="yes" will not do any indentation in mixed content elements, which is the effect you are looking for.

Alternatively, consider the extension xsl:output/@saxon:suppress-indentation (which has moved into the standard in 3.0). This allows you to list element names (such as p) whose content will not be indented.

Upvotes: 1

Oliver
Oliver

Reputation: 60

What about

<xsl:output  indent="yes"/>

Upvotes: 0

Related Questions