2016-12-01 1 views
2

XSLT를 사용하여 HTML을 PDF로 변환 중입니다. 원하지 않는 줄 바꿈이 생기고 그 이유를 모르겠습니다. 여기 XSL-FO에서 생성 된 PDF의 원하지 않는 줄 바꿈?

는 HTML 소스입니다 :

<li><strong>must</strong> only work in the occupation and for 
    the sponsor with the most recently approved nomination for 
    the holder <strong>unless</strong> the visa holder's 
    occupation is specified on a relevant instrument; 
</li> 

여기가 브라우저에서 모습입니다 :

<xsl:template match="condition/div"> 
    <xsl:apply-templates select="div|p|ul|li|a|ol|strong"/> 
</xsl:template> 

<xsl:template match="li" mode="bullet"> 
    <fo:list-item> 
      Unicode Bullet Character 
      <fo:list-item-label end-indent="label-end()"> 
       <fo:block> 
        &#x2022; 
       </fo:block> 
      </fo:list-item-label> 
      <fo:list-item-body start-indent="body-start()"> 
       <fo:block font-size="8pt" padding-bottom="2mm" padding-top="1mm"> 
        <xsl:apply-templates /> 
       </fo:block> 
      </fo:list-item-body> 
    </fo:list-item> 
</xsl:template> 

<xsl:template match="strong"> 
    <fo:block font-weight="bold">  
     <xsl:value-of select="." />  
    </fo:block> 
</xsl:template> 
:

여기 enter image description here

는 XSLT의 일부입니다

... 출력은 다음과 같습니다.

당신이 볼 수 있듯이 6,

enter image description here

는 원치 않는 줄 바꿈은 <strong> 태그 이후에 나타납니다. 어떤 아이디어가 이런 일을 막을 수 있을까요?

답변

2

당신은 (HTML처럼 div) fo:inline 여기 (HTML에서 span 같은)보다는 fo:block를 원한다.

변경

<xsl:template match="strong"> 
    <fo:block font-weight="bold">  
     <xsl:value-of select="." />  
    </fo:block> 
</xsl:template> 

<xsl:template match="strong"> 
    <fo:inline font-weight="bold">  
     <xsl:value-of select="." />  
    </fo:inline> 
</xsl:template> 

에는 strong 후 줄 바꿈을 제거합니다.

+3

나는 Stackoverflow를 좋아하고 kjhughes를 좋아합니다. :) –

관련 문제