xsl加载图像以获取元数据

发布于 2025-01-03 09:40:16 字数 367 浏览 2 评论 0原文

我想加载图像以获取元数据。我的代码是这样的: “url”的值是这样的:“http:\localhost:8080\mypics\pic1.jpg”

<xsl:call-template name="mypic">
  <xsl:with-param name="metadata" select="document($url)/metadata"/>
</xsl:call-template>

我得到这个异常:ID systÞme inconnu;利涅#47;柱廊#38;无法加载请求的文档:C:\http:\localhost:8080\mypics\pic1.jpg(未找到具体路径)

感谢帮助。

i would like to load an image to get the metadata. my code is like this :
the value of "url" is like this : "http:\localhost:8080\mypics\pic1.jpg"

<xsl:call-template name="mypic">
  <xsl:with-param name="metadata" select="document($url)/metadata"/>
</xsl:call-template>

i get this exception : ID systÞme inconnu; Ligne #47; Colonne #38; Unable to load the requested document : C:\http:\localhost:8080\mypics\pic1.jpg (the specific path was not found)

Thanks for help.

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

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

发布评论

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

评论(3

近箐 2025-01-10 09:40:16

$url 的值应为

http://localhost:8080/mypics/pic1.jpg

Update

根据 此文档您需要指定一个 URI,并且该 URI 处的资源必须是 xml 类型。我强烈怀疑你是否可以用这种表达方式处理图像。 document() 函数用于访问外部文档中的 (xml-) 节点。

我猜想,反斜杠使处理器相信该字符串指向相对于 C:\ 的文件资源。

The value of $url should be

http://localhost:8080/mypics/pic1.jpg

Update

According to this documentation you need to specify an URI and the resource at that URI has to be of xml type. I strongly doubt, that you can handle images with this expression. The document() function is used to access (xml-)nodes in external documents.

I guess, the backslashes made the processor believe the string was pointing to a file resource, relative to C:\.

灼疼热情 2025-01-10 09:40:16

我想加载图像以获取元数据。我的代码就像
这:“url”的值是这样的:
“http:\localhost:8080\mypics\pic1.jpg”

在 XSLT 中,您无法加载文件,除非它包含格式良好的 XML 文档,或者只是文本(非二进制)。

在 XSLT 转换中,只能加载 XML 文档(使用 document() 函数)或文本文件(使用 XSLT 2.0 unparsed-text())函数。

i would like to load an image to get the metadata. my code is like
this : the value of "url" is like this :
"http:\localhost:8080\mypics\pic1.jpg"

In XSLT you cant load a file unless it contains a well-formed XML document, or just text (not binary).

In an XSLT transformation only XML documents (with the document() function) or text files (with the XSLT 2.0 unparsed-text()) function can be loaded.

仅此而已 2025-01-10 09:40:16

我认为没有本地 XSLT 方法可以做到这一点,因为我猜 Dimitrie 会向我们展示一种方法(如果存在的话)。

另一种选择是放弃使用 Java。用 Java 编写您自己的扩展函数并从 XSLT 调用它。此链接显示了如何完成此操作:

http ://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/

I assume that there is no native XSLT way to do this as I guess Dimitrie would have shown us one if existed.

The alternative is to drop out to Java. Write your own extension function in Java and call it from your XSLT. This link shows how this can be done:

http://www.redstream.nl/2011/03/29/xslt-2-0-and-java-extensions/

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