放置xml节点';s属性文件中的完整路径,并读取节点';xsl fo中主xsl文件的s值
我一直在使用FOP0.95从xml数据生成pdf文件。我有三个文件参与了这个过程:test.xml、test.xsl和attributes.xsl。当然,我在xml文件中有xml数据。这里test.xml是从attributes.xsl文件导入属性集的主xsl文件。例如,attributes.xsl文件中有以下条目:放置xml节点';s属性文件中的完整路径,并读取节点';xsl fo中主xsl文件的s值,xml,pdf,xslt,pdf-generation,Xml,Pdf,Xslt,Pdf Generation,我一直在使用FOP0.95从xml数据生成pdf文件。我有三个文件参与了这个过程:test.xml、test.xsl和attributes.xsl。当然,我在xml文件中有xml数据。这里test.xml是从attributes.xsl文件导入属性集的主xsl文件。例如,attributes.xsl文件中有以下条目: <xsl:attribute-set name="headerTable" foa:class="table"> <xsl:attribute name=
<xsl:attribute-set name="headerTable" foa:class="table">
<xsl:attribute name="table-layout">fixed</xsl:attribute>
<xsl:attribute name="width">6.05in</xsl:attribute>
<xsl:attribute name="text-align">left</xsl:attribute>
<xsl:attribute name="white-space-collapse">false</xsl:attribute>
</xsl:attribute-set>
固定的
6.05英寸
左边
假的
现在,我的要求是将属性名放在属性文件中,并将相关值存储在xml文件中。这样:
<MyRoot>
<tableHeader>
<tableLayout>fixed</tableLayout>
<width>6.05in</width>
<textAlign>left</textAlign>
<whiteSpaceCollapse>false</whiteSpaceCollapse>
</tableHeader>
</MyRoot>
固定的
6.05英寸
左边
假的
在此之后,我将拥有如下属性文件:
<xsl:attribute-set name="headerTable" foa:class="table">
<xsl:attribute name="table-layout">MyRoot/tableHeader/tableLayout</xsl:attribute>
<xsl:attribute name="width">MyRoot/tableHeader/width</xsl:attribute>
<xsl:attribute name="text-align">MyRoot/tableHeader/textAlign</xsl:attribute>
<xsl:attribute name="white-space-collapse">MyRoot/tableHeader/whiteSpaceCollapse</xsl:attribute>
</xsl:attribute-set>
<fo:table xsl:use-attribute-sets="headerTable">
<fo:table-column column-width="3in"></fo:table-column>
<fo:table-column column-width="3.5in"></fo:table-column>
<fo:table-body>
<!--table rows and cells goes here-->
</fo:table-body>
</fo:table>
MyRoot/tableHeader/tableLayout
MyRoot/表格标题/宽度
MyRoot/tableHeader/textAlign
MyRoot/tableHeader/whiteSpaceCollapse
与往常一样,我使用主xsl文件中的属性,如下所示:
<xsl:attribute-set name="headerTable" foa:class="table">
<xsl:attribute name="table-layout">MyRoot/tableHeader/tableLayout</xsl:attribute>
<xsl:attribute name="width">MyRoot/tableHeader/width</xsl:attribute>
<xsl:attribute name="text-align">MyRoot/tableHeader/textAlign</xsl:attribute>
<xsl:attribute name="white-space-collapse">MyRoot/tableHeader/whiteSpaceCollapse</xsl:attribute>
</xsl:attribute-set>
<fo:table xsl:use-attribute-sets="headerTable">
<fo:table-column column-width="3in"></fo:table-column>
<fo:table-column column-width="3.5in"></fo:table-column>
<fo:table-body>
<!--table rows and cells goes here-->
</fo:table-body>
</fo:table>
执行时,我得到以下错误:
"Ignoring property: table-layout="MyRoot/tableHeader/tableLayout" <Illegal character; property:'table-layout'>"
忽略属性:table layout=“MyRoot/tableHeader/tableLayout”
有人知道如何做到这一点吗?谢谢。在浏览了各种网站后,在这里的问题没有得到任何回应,我对这个问题感到很难过。在思考问题并进行点击和试用时,我只想说:
<xsl:attribute name="width">
<xsl:value-of select="MyRoot/tableHeader/width">
</xsl:value-of>
</xsl:attribute>
而不是属性文件中的以下内容:
<xsl:attribute name="width">MyRoot/tableHeader/width</xsl:attribute>
MyRoot/tableHeader/width
我对属性文件中的所有xml节点路径也做了同样的处理。这真管用!谢谢。在浏览了各种网站后,在这里的问题没有得到任何回应,我对这个问题感到很难过。在思考问题并进行点击和试用时,我只想说:
<xsl:attribute name="width">
<xsl:value-of select="MyRoot/tableHeader/width">
</xsl:value-of>
</xsl:attribute>
而不是属性文件中的以下内容:
<xsl:attribute name="width">MyRoot/tableHeader/width</xsl:attribute>
MyRoot/tableHeader/width
我对属性文件中的所有xml节点路径也做了同样的处理。这真管用!谢谢