我有一个标签的xml,其中包含一个属性,其中的内容为html。我需要将此html转换为xsl-fo。这里是我的XSLT代码:Xml内容没有被模板识别
<xsl:template match ="rtf">
<fo:block-container>
<fo:block>
<xsl:call-template name ="ConvertHtmlToXslfo">
<xsl:with-param name ="content">
<xsl:value-of select ="@rtfAsHtml" disable-output-escaping ="yes"/>
</xsl:with-param>
</xsl:call-template>
</fo:block>
</fo:block-container>
</xsl:template>
<xsl:template name="ConvertHtmlToXslfo">
<xsl:param name ="content"></xsl:param>
<fo:block-container>
<xsl:apply-templates select="msxsl:node-set($content)"/> <!--here is the problem-->
</fo:block-container>
</xsl:template>
<xsl:template match ="div">
<fo:block-container>
<!--more code here-->
</fo:block-container>
</xsl:template>
<xsl:template match ="p">
<fo:block>
<!--more code here-->
</fo:block>
</xsl:template>
<xsl:template match ="span">
<fo:inline>
<!--more code here-->
</fo:inline>
</xsl:template>
但是有一个问题,当呼叫应用的模板在这个HTML内容。相关的模板不能识别它。
这里是XML标记与的Html属性在里面:
<rtf rtfAsHtml="<div ><p ><span>Hi!</span></p></div>"/>
任何想法如何将这个HTML标记转换为XSL-FO?
谢谢!
您的输入文件是否有任何名称空间声明?另外,如果你能够匹配“rtf”作为文档节点,在我看来你的输入是RTF而不是HTML。 –
@MathiasMüller。不,我的输入没有任何命名空间。而且,我的输入是一个包含从rtf转换而来的html的xml标签。但它是HTML。 – Jacob