对不起,当我找不到答案时,但我没有提出正确的问题。我有 APEX 4 并尝试从多阵列选择创建报告。例如数据是:
Name1 Value1
Name1 Value2
Name1 Value3
Name1 Value4
Name2 Value5
Name2 Value6
Name2 Value7
我需要在报告中输出:
-Name1
--Value1
--Value2
--Value3
--Value4
-Name2
--Value5
--Value6
--Value7
我需要在类似于 php 的 XSL 中执行此操作:
$x_key= '';
foreach($arr as $key=>$value)
{
if ($x_key != $key) {
$x_key = $key;
echo "-$key\n";
}
echo "--$value\n";
}
我的代码可能是(但不要按照我的意愿去做):
<xsl:variable name="NAMEOLD" select="X" />
<xsl:for-each select="//ROWSET1_ROW[position()]">
<xsl:variable name="NAME" select="NAME_NUMBER" />
<xsl:choose>
<xsl:when test="NAME!=NAMEOLD">
<xsl:variable name="NAMEOLD" select="NAME" />
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="cell-transparent" >
<fo:block xsl:use-attribute-sets="align-left txt" keep-together.within-page="always">
<xsl:value-of select="NAME_NUMBER"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:when>
</xsl:choose>
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="cell-transparent" >
<fo:block xsl:use-attribute-sets="align-left txt" keep-together.within-page="always">
<xsl:value-of select="VALUE"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:for-each>
感谢您提供任何线索或回答 Stoupa101