0

我有下面的 xml,其中在转换后需要删除空格。

<section level="sect1" number-type="manual" num="I.">
    <title>INTRODUCTION</title>
    <para>
        <phrase>14.001</phrase> When a company in financial difficulty is unable to discharge its debts when they are due, a creditor has the right to take actions to, for example, realise assets or to have the company wound up compulsorily. However, putting the company in liquidation at the first sign of financial difficulty may not be the optimal choice for every stakeholder in the firm. Employees will lose their jobs. The company will lose its productive capacity, especially if the business is to be sold piecemeal. Unsecured creditors may not be able to recoup a penny from their investment. On the other hand, if the company is given a respite or, better still, some assistance in other forms, such as injection of fresh capital, in addition to some breathing space, the company may be nurtured back to its financial health. Even where resuscitation of the company is impossible, rescue measures may yield better economic results for most, if not all, stakeholders in the company enterprise. "Corporate rescue" therefore is a favoured alternative to liquidation in most of the developed economies. </para>
    <para>This chapter provides an overview of the ways in which corporate rescue has been effected in Hong Kong, although the focus of the examination is on the mechanisms under the Companies Ordinance (Cap 32) which have been used to effect corporate rescues. The remainder of this Chapter is organised into five parts. Part II and III consider the meaning and significance of corporate rescue. Part IV outlines the methods of corporate rescue. Part V and VI examine various informal approaches and formal legal devices that have been adopted or employed to effect corporate rescue in Hong Kong. </para>
</section>

当我使用下面的 xslt 时,它会正确显示输出,但我希望删除短语标签后第一个段落中的空格。

<xsl:template name="para" match="section/para">
            <div class="para">
            <xsl:apply-templates/>              
            </div>
</xsl:template>

电流输出如下。

<div class="para"> When a company in financial difficulty is unable to discharge its debts when they are due, a creditor has the right to take actions to, for....</para>

和预期的输出是

<div class="para">When a company in financial difficulty is unable to discharge its debts when they are due, a creditor has the right to take actions to, for...</para>

我尝试使用下面的,但它没有用。

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

谢谢

4

1 回答 1

2

请尝试将此模板添加到您现有的 XSLT:

<xsl:template match="para/text()">
  <xsl:value-of select="normalize-space()" />
</xsl:template>
于 2013-04-23T15:30:43.717 回答