【发布时间】:2019-08-09 04:58:52
【问题描述】:
我有一个使用 XSLT 执行 XML 映射的程序。我为此使用 Saxon-HE-9.7 库。我还在 XSLT 中使用自反扩展函数。
XSLT 调用一个返回 ArrayList<HashMap<String, String>> 的 java 函数
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0" xmlns:SQLService="com.db.SQLService" xmlns:ArrayList="java:java.util.ArrayList" xmlns:HashMap="java.util.HashMap" >
<xsl:output method="xml" indent="yes" />
<xsl:variable name="city">Texas</xsl:variable>
<xsl:variable name="query" select="'Select name, emp_id from employee where city = ?'" />
<xsl:variable name="list" select="SQLService:executeQueryMultiResult($query, $city)" />
<xsl:template match="/">
<test>
<xsl:for-each select="abc/company[@type='product']">
<employee>
<xsl:attribute name="details">
<xsl:value-of select="$list" />
</xsl:attribute>
</employee>
</xsl:for-each>
</test>
</xsl:template>
</xsl:stylesheet>
我只得到列表中的单条记录,这是 executeQueryMultiResult 返回的列表的最后一条记录。
我想存储和迭代列表的所有元素?
【问题讨论】:
-
试试
-
@AjeetSingh 试过了,没用。
-
HE是否支持反身扩展功能?我虽然它们仅在商业 PE 和 EE 版本中受支持。