xsl加载图像以获取元数据
我想加载图像以获取元数据。我的代码是这样的: “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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
$url
的值应为Update
根据 此文档您需要指定一个 URI,并且该 URI 处的资源必须是 xml 类型。我强烈怀疑你是否可以用这种表达方式处理图像。
document()
函数用于访问外部文档中的 (xml-) 节点。我猜想,反斜杠使处理器相信该字符串指向相对于
C:\
的文件资源。The value of
$url
should beUpdate
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:\
.在 XSLT 中,您无法加载文件,除非它包含格式良好的 XML 文档,或者只是文本(非二进制)。
在 XSLT 转换中,只能加载 XML 文档(使用
document()
函数)或文本文件(使用 XSLT 2.0unparsed-text()
)函数。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.0unparsed-text()
) function can be loaded.我认为没有本地 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/