I'm struggling a bit with a Content Picker. I can't seem to render content from a node chosen with the content picker, I can render the link to the document fine, but get nothing when trying to render any of the fields in the document type, any ideas what I'm doing wroing?
Code below:
<xsl:param name="currentPage"/>
<!-- Don't change this, but add a 'contentPicker' element to --> <!-- your macro with an alias named 'source' --> <xsl:variable name="featuredArticle" select="/macro/featuredArticle"/>
<xsl:template match="/">
<!-- some output -->
<!-- output link here, if there was a node picked: --> <xsl:apply-templates select="$currentPage/featuredArticle[normalize-space()]" /> <!-- some more output -->
</xsl:template>
<!-- Template for link --> <xsl:template match="featuredArticle"> <xsl:value-of select="articleTitle" disable-output-escaping="yes"/> <a href="{umbraco.library:NiceUrl(.)}">Link text</a> </xsl:template>
To clarify, my challenge is rendering the content of the selected source as opposed to one of its children...I'm sure I'm missing something fundamental here.
Thank you for that step in the right direction! The code below worked great. Not sure if there was an advantage to using the format above? The normal for-each statement works fine with the exception of the int32 error in the validator.
Render content chosen with Content Picker
Hi,
I'm struggling a bit with a Content Picker. I can't seem to render content from a node chosen with the content picker, I can render the link to the document fine, but get nothing when trying to render any of the fields in the document type, any ideas what I'm doing wroing?
Code below:
Thanks!
Amir
To clarify, my challenge is rendering the content of the selected source as opposed to one of its children...I'm sure I'm missing something fundamental here.
A content picker brings you an id, so what does the following give you?
the following may also help
http://our.umbraco.org/wiki/reference/umbracolibrary/getxmlnodebyid
Thank you for that step in the right direction! The code below worked great. Not sure if there was an advantage to using the format above? The normal for-each statement works fine with the exception of the int32 error in the validator.
<xsl:for-each select="umbraco.library:GetXmlNodeById($currentPage/featuredArticle)">
-Amir
is working on a reply...