cod*_*joe 2 pdf xslt pdf-generation xsl-fo
我正在研究xslt和xsl-fo代码,分别转换为html和pdf.
在我的源码xml我有一个表,我可以直接复制为html输出.
<text>
<table border='1'>
<thead>
<tr><th>Problem</th><th>Date</th><th>Comments</th>
</tr>
</thead>
<tbody>
<tr>
<td>Cholecystitis</td><td>9/28/2002 - 6/2003</td>
<td>Resolved</td>
<td>Surgery postponed until after delivery</td>
</tr>
<tr>
<td>Pregnancy</td><td>7/2001 - 4/22/2002</td>
<td>Resolved</td>
<td>Prior history of miscarraige</td>
</tr>
<tr><td>Ankle Sprain</td><td>3/28/2005</td>
<td>Current</td>
<td>Slipped on ice and fell</td>
</tr>
</tbody>
</table>
</text>
Run Code Online (Sandbox Code Playgroud)
我只是用它来复制节点的内容:
<xsl:copy-of select="."/>
Run Code Online (Sandbox Code Playgroud)
我认为这适用于xslt转换为html,因为浏览器可以直接解释它.但是对于我的pdf,我想我必须使用完全不同的xsl-fo.我知道在xsl-fo中我必须使用:
<fo:table>
Run Code Online (Sandbox Code Playgroud)
但是,是否有一种"标准"方式来格式化此表以便能够将其用于我的pdf生成?pdf的xsl:copy生成一行,其中包含所有已剥离的值,但没有表.
谢谢!
=====================================
我正在尝试做的是编写一些xslt来"解析"我的源xml文件中嵌入的表,以生成如下所示的内容:
<fo:table table-layout="fixed" width="100%">
<fo:table-column column-width="25mm"/>
<fo:table-column column-width="25mm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block>
something
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block>
something
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
Run Code Online (Sandbox Code Playgroud)
它是要走的路吗?!表非常标准,我认为html表可以很容易地转换为xslt/xsl-fo.
所以,
为了解决我的问题,我发现一篇IBM文章正好解释了我的目的:"HTML格式化对象(FO)转换指南"
http://www.ibm.com/developerworks/library/x-xslfo2app/#table
这很简单,但你需要有经验才能解决这个问题......我不是那么感谢IBM.
| 归档时间: |
|
| 查看次数: |
17569 次 |
| 最近记录: |