Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将XSL-FO url函数转换为模板_Url_Xslt_Xsl Fo_Param - Fatal编程技术网

将XSL-FO url函数转换为模板

将XSL-FO url函数转换为模板,url,xslt,xsl-fo,param,Url,Xslt,Xsl Fo,Param,我正在使用ApacheFopVersion1.1通过命令行构建pdf 这是我的XSL,运行良好 <fo:table-row > <fo:table-cell > <fo:block > <fo:external-graphic content-height="9mm" content-width="9mm" height="10mm" width="10mm" scaling="non-uniform" s

我正在使用ApacheFopVersion1.1通过命令行构建pdf 这是我的XSL,运行良好

<fo:table-row >
    <fo:table-cell >
        <fo:block >
            <fo:external-graphic content-height="9mm" content-width="9mm" height="10mm" width="10mm" scaling="non-uniform" src="url(./images/pict2.jpg)" />
        </fo:block>
    </fo:table-cell>
</fo:table-row >
如果我尝试使用以这种方式声明的模板

<xsl:template name="myRow" >
    <xsl:param name="imgUrl"/>
    <fo:table-row >
        <fo:table-cell >
            <fo:block >
                <fo:external-graphic content-height="9mm" content-width="9mm" height="10mm" width="10mm" scaling="non-uniform" src="url($imgUrl)"/>
            </fo:block>
        </fo:table-cell>
    </fo:table-row >
</xsl:template>
我称之为

<xsl:call-template name="myRow">
    <xsl:with-param name="imgUrl" select="'./images/pict2.jpg'" />
</xsl:call-template>
没有显示图像。 如果我写select=./images/pict2.jpg时没有单引号,imgUrl参数为null
如何传递url并使其工作?

如果要引用属性中的变量,需要使用属性值模板

在模板中尝试这一行

<fo:external-graphic content-height="9mm" content-width="9mm" height="10mm" width="10mm" 
                     scaling="non-uniform" src="url({$imgUrl})"/>
大括号表示要求值的表达式,而不是按字面意义上的输出,即当前代码中发生的情况。它实际上是输出文本$imgUrl,而不是变量的值