我正在尝试将xsl:fo
转换为xslt
(用于HTML输出)。然后,我将应用xslt
而不是xsl:fo
获取HTML输出而不是PDF。从xsl生成html xslt:fo
这怎么办?
我需要XML处理API或将XML和XSL转换为另一个输出的JAXP。于是,我试着写的XSLT模板:
<xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo"
>
<xsl:template match="/xsl:template[@match='/root']/fo:root">
<xsl:apply-templates select="fo:page-sequence"/>
</xsl:template>
<xsl:template match="fo:page-sequence">
<xsl:for-each select="fo:flow[@flow-name='xsl-region-body']">
<xsl:call-template name="xsl-regional-body">
<xsl:with-param name="fontsize"><xsl:value-of select="@font-size"/></xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name="xsl-regional-body">
<xsl:param name="fontsize" />
<body>
<xsl:if test="$fontsize"> <!-- costruisce <font size=""> -->
<font>
<xsl:attribute name="size">
<xsl:value-of select="$fontsize"/>
</xsl:attribute>
</font>
</xsl:if>
<xsl:for-each select="*/xsl:choose">
<xsl:call-template name="xsl-choose"/>
</xsl:for-each>
<xsl:apply-templates select="."/>
</body>
</xsl:template>
<xsl:template name="xsl-choose">
<xsl:value-of select="."/>
</xsl:template>
我获得类似
<body><font size="10pt"/>
...
text words..
</body>
但它删除所有的xsl:选择XSL:当与其他标签,如 我需要所有这些标签,因为我需要传递xml数据,第二次使用Jaxp并生成html .. 我将获得
<body><font size="10pt"/>
<xsl:choose>
<xsl:when test="ddx[@id='LET.....>
<xsl::value-of select="ddx[@id='Lx']/r/PE...>
</xsl:when>..
</xsl:choose>
text words..
</body>
如何获取文本节点的XSL节点?
只是要清楚......我相信你正在试图创造条件,设计制作XSL FO的XSL转换为XSL是将一个XSL生成HTML,更正?意思是你想映射所有的结构像fo:block到p和fo:table到table等等? – 2015-03-31 03:53:01
您无权访问用作FO转换输入的XML?如果你这样做,那将是一个更简单的起点。 – Hobbes 2015-04-02 09:53:27