2013-09-04 4 views
1

xml의 일부분을 가지고 있습니다.태그 뒤에 공백을 제거하는 방법이 있습니까?

<para>There are three types of investment vehicles available for foreign investors, i.e. Chinese-Foreign equity joint venture, Chinese-Foreign cooperative joint venture and wholly foreign-owned enterprises.<footnote num="8"> 
        </footnote> 
</para> 

여기 템플릿을 적용하려고 할 때 공백이 만들어지며 다음과 같습니다.

<xsl:template match="footnote"> 
     <sup><a><xsl:attribute name="name"><xsl:text>f</xsl:text><xsl:value-of select="@num"/></xsl:attribute> 
       <xsl:attribute name="href"><xsl:text>#ftn.</xsl:text><xsl:value-of select="@num"/></xsl:attribute> 
       <xsl:attribute name="class"><xsl:text>tr_ftn</xsl:text></xsl:attribute> 
       <xsl:value-of select="@num"/> 
      </a> 
     </sup> 
<xsl:apply-templates/> 

내가 얻을 출력은

<sup> 
<a name="f8" href="#ftn.8" class="tr_ftn">8</a> 
</sup> 

입니다하지만 난 아래 템플릿을하려고 할 때

<xsl:template match="footnote"> 
     <sup><xsl:text>Hi</xsl:text><a><xsl:attribute name="name"><xsl:text>f</xsl:text><xsl:value-of select="@num"/></xsl:attribute> 
       <xsl:attribute name="href"><xsl:text>#ftn.</xsl:text><xsl:value-of select="@num"/></xsl:attribute> 
       <xsl:attribute name="class"><xsl:text>tr_ftn</xsl:text></xsl:attribute> 
       <xsl:value-of select="@num"/> 
      </a> 
     </sup> 
<xsl:apply-templates/> 

내가 얻을 출력은

<sup>Hi<a name="f8" href="#ftn.8" class="tr_ftn">8</a> 
</sup> 

실제 예상 출력

입니다
<sup><a name="f8" href="#ftn.8" class="tr_ftn">8</a> 
    </sup> 

제 3 출력을 얻을 수있는 방법이 있다면 알려주십시오. 공백이없고 표시 텍스트가 없음). 첫 번째 경우에 (여기 실제로 8 상 첨부한다)

HTML 출력은

조 외국인 소유 기업이다. 8 참조,

와 두 번째 경우에 대한

조 외국인 소유 기업이다. 하이 8 참조는

조 외국인 소유 기업

을 기대했다. 8 참조,

감사

+0

여기에 표시된 템플릿은''태그를 제대로 닫지 않았기 때문에 작동하지 않습니다. 사용중인 XSLT의 전체 예제를 보여줄 수 있습니까? –

답변

2

내 생각 엔 당신이 <xsl:output indent="yes"/>이 있고 그것을 제거하거나 <xsl:output indent="no"/>를 사용할 수 있다는 것입니다.

관련 문제