到目前为止,加载外部文档的唯一方法是硬编码路径。我希望能够使用相对路径或变量。
我创建了一个重氮规则,它从外部页面(称为“页脚-列”)转换内容,并将其放在主题页面中。
版本A-此版本工作(注意硬编码路径):
<replace css:theme-children=".footer-menu-row">
<xsl:for-each
select="document('http://example.com/footer-columns')//*/dl[contains(@class,'portletStaticText')]/dd"
><div class="w-col w-col-3">
<xsl:copy-of select="." />
</div>
</xsl:for-each>
</replace>版本B-此版本不起作用:
<replace css:theme-children=".footer-menu-row">
<xsl:for-each
select="document('{$portal_url}/footer-columns')//*/dl[contains(@class,'portletStaticText')]/dd"
><div class="w-col w-col-3">
<xsl:copy-of select="." />
</div>
</xsl:for-each>
</replace>版本C-绝对路径不工作(实际上它返回一个错误):
<replace css:theme-children=".footer-menu-row">
<xsl:for-each
select="document('/footer-columns')//*/dl[contains(@class,'portletStaticText')]/dd"
><div class="w-col w-col-3">
<xsl:copy-of select="." />
</div>
</xsl:for-each>
</replace>版本D-相对路径不工作(实际上它返回一个错误):
<replace css:theme-children=".footer-menu-row">
<xsl:for-each
select="document('footer-columns')//*/dl[contains(@class,'portletStaticText')]/dd"
><div class="w-col w-col-3">
<xsl:copy-of select="." />
</div>
</xsl:for-each>
</replace>对于C和D版本,我得到相同的错误:
AttributeError: PersistentResourceDirectory对象没有属性“getPhysicalPath”
发布于 2015-07-14 19:02:42
您需要为document()方法提供一个节点集。Diazo已经用适当的节点集设置了一个名为diazo-base-document的变量。
尝试:
select="document('footer-columns', $diazo-base-document)//*/dl[contains(@class,'portletStaticText')"发布于 2015-07-15 00:32:07
你能在href="/footer-columns"标签上指定replace吗?
https://stackoverflow.com/questions/31406327
复制相似问题