Reputation: 2569
So far the only way to load my external document is to hardcode the path. I'd like to be able to use a relative path or variable.
I've created a Diazo rule which transforms content from an external page (called 'footer-columns') and places it in my themed pages.
Version A - This version works (note the hardcoded path):
<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>
Version B - This version does not work:
<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>
Version C - absolute path does not work (in fact it returns an error):
<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>
Version D - relative path does not work (in fact it returns an error):
<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>
For version C and D I get the same error:
AttributeError: 'PersistentResourceDirectory' object has no attribute 'getPhysicalPath'
Upvotes: 0
Views: 114
Reputation: 2601
You need to provide a nodeset to the document()
method. Diazo already sets a variable named diazo-base-document
with the proper nodeset.
Try:
select="document('footer-columns', $diazo-base-document)//*/dl[contains(@class,'portletStaticText')"
Upvotes: 0