xslt - (Umbraco) Can get text but not image from a subnode to homepage -
i'm trying text , image articles in subsection "featured" (home/featured/article1, 2,...,n) don't image. code works fine getting text every article inside 'featured' node.
<xsl:if test="position() < $maxitems"> <h3><a href="{umbraco.library:niceurl(@id)}"> <xsl:value-of select="newstitle"/> </a> </h3> <strong><xsl:value-of select="intro"/></strong> <br/> <small> a: <xsl:value-of select="umbraco.library:formatdatetime($currentpage/@updatedate, 'mmmm d, yyyy')"/> por: <xsl:value-of select="author"/> </small> </xsl:if>
it works fine. cannot images article. i'm trying way, among others:
<a href="{umbraco.library:niceurl(@id)}"> <xsl:if test="count(./* [@isdoc]) > 0"> <img src="{concat(substring-before(./*/thumbnail,'.'), '_thumb.jpg')}"/> </xsl:if> </a>
i don't know here, i'm using 'upload' property element , 'mediapicker' (alias: 'thumbnail'), so, i've been testing these property types didn't yet. want put image (if exists) of article next text retrieved childnode homepage.
i'll appreciate help. in advance!
[umbraco 6.1.3]
i think error need select property, not node. using @isdoc attribute, no properties selected.
as mentioned, "thumbnail" property on node (assuming 1 thumbnail here) of datatype "upload" (saves value of path string):
<xsl:if test="string-length(./thumbnail) > 0"> <a href="{umbraco.library:niceurl(@id)}"> <img src="{concat(substring-before(./thumbnail,'.'), '_thumb.jpg')}"/> </a> </xsl:if>
or "media picker" datatype (saves nodeid of media-item int):
<xsl:if test="string-length(./thumbnail) > 0"> <xsl:variable name="image" select="umbraco.library:getmedia(./thumbnail,0)"/> <a href="{umbraco.library:niceurl(@id)}"> <img src="{concat(substring-before($image/umbracofile,'.'), '_thumb.jpg')}"/> </a> </xsl:if>
since other code posted working fine, , not using $currentpage, assume code wrapped in template or iterating on set of nodes.
i put link element inside if statement , check whether thumbnail available or not before creating link, avoid empty link elements.
Comments
Post a Comment