[英]XSLT 2.0 preserve space after element
I have a xml file like this: 我有一个这样的xml文件:
<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: 我只需要在块元素而不是内联元素中转换(使用xslt Saxon PE)缩进,例如:
<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>
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. 如果对结果文档进行模式验证(这需要Saxon-EE),则indent="yes"
将不会在混合内容元素中进行任何缩进,这就是您要寻找的效果。
Alternatively, consider the extension xsl:output/@saxon:suppress-indentation
( which has moved into the standard in 3.0 ). 或者,考虑扩展名xsl:output/@saxon:suppress-indentation
( 已在3.0中移入标准 )。 This allows you to list element names (such as p) whose content will not be indented. 这使您可以列出其内容不会缩进的元素名称(例如p)。
关于什么
<xsl:output indent="yes"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.