Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 从XSL-FO生成的PDF中不需要的换行符?_Html_Xml_Pdf_Xslt_Xsl Fo - Fatal编程技术网

Html 从XSL-FO生成的PDF中不需要的换行符?

Html 从XSL-FO生成的PDF中不需要的换行符?,html,xml,pdf,xslt,xsl-fo,Html,Xml,Pdf,Xslt,Xsl Fo,我正在使用XSLT将一些HTML转换为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>

我正在使用XSLT将一些HTML转换为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>
  • 必须仅在该职业和 最新获得批准提名的赞助商 持有人除非签证持有人的 相关文书上规定了职业;
  • 下面是它在浏览器中的外观:

    以下是一些XSLT:

    <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>
    
    
    Unicode项目符号字符
    •;
    
    …以下是输出结果:

    如您所见,不需要的换行符出现在
    标记之后。有什么办法阻止这种情况发生吗?

    你想在这里(比如HTML中的
    span
    ),而不是(比如HTML中的
    div

    改变

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

    
    

    要消除
    strong

    之后的换行符,我喜欢Stackoverflow,我喜欢kjhughes.)
    <xsl:template match="strong">
        <fo:inline font-weight="bold">       
            <xsl:value-of select="." />    
        </fo:inline>
    </xsl:template>