首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在XSLT中存在-db-路径

在XSLT中存在-db-路径
EN

Stack Overflow用户
提问于 2016-01-22 13:07:54
回答 1查看 148关注 0票数 0

我需要抓取一些图像,并将它们放入通过Apache生成的pdf中。在eXist之外,我没有任何问题。使用eXist,模板不能正常工作,输出中没有图像--可能是路径出现了问题。

“档案”的结构是:

代码语言:javascript
复制
project/data/file.xml
project/data/img/*pictures.jpg

测试来源:

代码语言:javascript
复制
<figure>
    <graphic url="img/tealover.jpg"/>
</figure>

<figure>
    <graphic url="./img/tealover.jpg"/>
</figure>

<figure>
    <graphic url="/db/apps/karolinum-apps/data/img/tealover.jpg"/>
</figure>

模板:

代码语言:javascript
复制
<xsl:template match="tei:figure/tei:graphic">
    <fo:block>
        <fo:external-graphic src="{@url}" xsl:use-attribute-sets="images"/>
    </fo:block>
    <xsl:apply-templates/>
</xsl:template>

问题在哪里?我是不是错过了一些eXist的设置?在ePub生产期间收集图像时,这是没有问题的。

更新

XSL-FO输出:

代码语言:javascript
复制
<fo:block>
    <fo:external-graphic width="50%" content-height="100%" content-width="scale-to-fit" scaling="uniform" src="img/tealover.jpg"/>
</fo:block>
<fo:block>
    <fo:external-graphic width="50%" content-height="100%" content-width="scale-to-fit" scaling="uniform" src="./img/tealover.jpg"/>
</fo:block>
<fo:block>
    <fo:external-graphic width="50%" content-height="100%" content-width="scale-to-fit" scaling="uniform" src="/db/apps/karolinum-apps/data/img/tealover.jpg"/>
</fo:block>
EN

回答 1

Stack Overflow用户

发布于 2016-01-26 10:26:46

这似乎是个妙招:

代码语言:javascript
复制
<xsl:template match="tei:figure/tei:graphic">
    <fo:block>
        <fo:external-graphic src="url('{resolve-uri(@url, base-uri(.))}')" xsl:use-attribute-sets="images"/>
    </fo:block>
    <xsl:apply-templates/>
</xsl:template>

更新

有意思的!一开始它很有魅力。后来,我稍微重新安排了项目的结构(但文档附近的环境实际上是一样的),现在它不起作用了。它记录:

代码语言:javascript
复制
exerr:ERROR Exception while transforming node: Base URI {} is not an absolute URI [at line 11, column 19] In function:
fop:render-pdf(node()*) [12:5:/db/apps/karolinum-apps/modules/create-pdf.xqm]

但问题显然是在这一行代码中。

即使我尝试<xsl:value-of select="resolve-uri(@url, base-uri(.))"/>,它也会抱怨

代码语言:javascript
复制
exerr:ERROR Exception while transforming node: Base URI {} is not an absolute URI [at line 16, column 9]

目前还不能理解这么小的细节。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34947473

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档