使用xpath和xml作为数据源时如何在Ireport 4.5中使用参数

发布于 2024-12-26 23:04:39 字数 436 浏览 1 评论 0原文

有谁知道如何在 Ireport 中使用 xpath 中的参数。我正在使用 4.5

我有这样的东西可以工作:

<fieldDescription><![CDATA[origin/localizedNames/name[@lang = "en"]]]></fieldDescription>

我想做的是类似

<fieldDescription><![CDATA[origin/localizedNames/name[@lang = "$P{lang}"]]]></fieldDescription>

Where lang is my parameter...但它似乎不起作用,我在网上找不到任何例子。

提前致谢, 迪米特里

Does anyone know how to use a parameter within and xpath in Ireport. I am using 4.5

I have something like this that works:

<fieldDescription><![CDATA[origin/localizedNames/name[@lang = "en"]]]></fieldDescription>

and what i want to do is something like

<fieldDescription><![CDATA[origin/localizedNames/name[@lang = "$P{lang}"]]]></fieldDescription>

Where lang is my parameter... but it does not seem to work and i cant find any example on the net.

thanks in advance,
Dimitri

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不寐倦长更 2025-01-02 23:04:39

您可以在 XPath 表达式中使用参数

示例:

<queryString language="xPath"><![CDATA[/Northwind/Orders[CustomerID='$P{CustomerID}']]]></queryString>

您可以在 JasperReports 分发包

您还可以阅读这篇文章,了解XPath 使用。

You can use parameters in XPath expressions.

The sample:

<queryString language="xPath"><![CDATA[/Northwind/Orders[CustomerID='$P{CustomerID}']]]></queryString>

You can find the sample in folder %jasperreports%\demo\samples\xmldatasource from JasperReports distribution package.

You can also read this article about XPath using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文