Форматирование вывода XSLT: сохранять разрывы строк, удалять отступы
Вот мой XML:
<doc>
<article>
<texte>
<notes>-</notes>
<content>
<title>T 1</title>
<argument>Arg 1</argument>
<p>Paragraph 1.1</p>
<p>Paragraph 1.2</p>
<p>Paragraph <i>1.3</i></p>
<short-author>FB</short-author>
</content>
<notes>-</notes>
<content>
<title>T2</title>
<p>Paragraph 2.1</p>
<short-author>JD</short-author>
</content>
<notes>-</notes>
<content>
<title>T3</title>
<argument>Arg 3</argument>
<p>Paragraph 3.1</p>
<short-author>NC</short-author>
</content>
</texte>
</article>
</doc>
Это XSL (спасибо Димитру):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="//comment()"/>
<xsl:template match="@class" />
<xsl:template match="node()[not(self::doc|self::texte|self::author|self::style|self::span)]|@*" >
<xsl:copy>
<xsl:apply-templates select="node()[not(self::author)]|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Все идет нормально. Я бы хотел
сохранить разрывы строк иудалить отступКогда я устанавливаю выходной отступ «да», я получаю как разрывы строк, так и отступы. Когда я устанавливаю выходной отступ «нет», я не получаю ничего.
Спасибо!