我正在使用代表列表的参数打印表体。说出来p1。
我会写
<xsl:for-each select="$p1">
通常在列中打印数据
<fo:table-cell>
<fo:block text-align="left" padding-top="2pt">
<xsl:value-of select="$p1/value"/>
</fo:block>
</fo:table-cell>
对于其他列,我需要从另一个变量(不是p1)打印数据。现在,我遇到了以下问题:我想使用p1作为参数,但是从另一个参数(例如p2)打印,该参数表示与p1尺寸相同的列表。此列表p2的右索引由position()给出。 我尝试过类似的
<fo:table-cell>
<fo:block text-align="left" padding-top="2pt">
<xsl:value-of select="$p2.get(position())"/>
</fo:block>
</fo:table-cell>
但是它不起作用。有正确的方法和语法来做到这一点吗?谢谢
编辑:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root-name PUBLIC "http://fop/DTD Validator" "fo.dtd" >
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xobj="it.sempla.pef.util.stampe.StampeFormatter"
exclude-result-prefixes="fo">
<xsl:output method="xml" version="1.0" omit-xml-declaration="no"
indent="yes" />
<xsl:template name="leveragedTransaction">
<xsl:param name="perimetroChecklistLT" />
<xsl:param name="verificaChecklistLT" />
<fo:table table-layout="fixed" width="100%"
space-before.minimum="2pt">
<fo:table-column column-width="50%" />
<fo:table-column column-width="50%" />
<fo:table-body font-size="9pt" color="black" margin="0pt 0.7pt"
text-align="left">
<xsl:for-each select="$perimetroChecklistLT">
<fo:table-row border-top-style="solid"
border-top-color="#A6A6A6" border-top-width="0.6pt">
<fo:table-cell border-left-style="solid"
border-left-color="#A6A6A6" border-left-width="0.6pt">
<fo:block text-align="left" padding-top="2pt">
<xsl:value-of select="$verificaChecklistLT"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-left-style="solid"
border-left-color="#A6A6A6" border-left-width="0.6pt">
<fo:block text-align="left" padding-top="2pt">
<xsl:value-of select="$perimetroChecklistLT/valoreRecuperato" />
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
</fo:table-body>
</fo:table>
</xsl:template>
</xsl:stylesheet>
我要迭代的参数是perimetroChecklistLT
。此参数还用于打印第二列(<xsl:value-of select="$perimetroChecklistLT/valoreRecuperato" />
)。不幸的是,我需要从另一个参数verificaChecklistLT
打印。参数代表两个相同长度的列表。特别地,verificaChecklistLT
是一个字符串列表。我想访问verificaChecklistLT
的第i个组件以打印正确的字符串。如果是这种情况,我将在Java中写verificaCheckListLT.get(i)
。
我知道i
等于position()
,但是如何实现呢?