Only show div if alias has content... What am I doing wrong?
Hi Umbracians
I have a problem using the if-test statement... I have an image slider in one of my templates, which uses the XSLT you see below. The images are created as sub-nodes of the node they should be shown in... And it works fine, until I try to tell the XSLT that it should only show the "imageText" div when the alias "contentPicture" is filled out... The "contentPicture" is an alias on the picture document type.
I dont know what I am doing wrong here... Can someone please help me out?
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
Only show div if alias has content... What am I doing wrong?
Hi Umbracians
I have a problem using the if-test statement... I have an image slider in one of my templates, which uses the XSLT you see below. The images are created as sub-nodes of the node they should be shown in... And it works fine, until I try to tell the XSLT that it should only show the "imageText" div when the alias "contentPicture" is filled out... The "contentPicture" is an alias on the picture document type.
I dont know what I am doing wrong here... Can someone please help me out?
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<li class="squareRandom">
<div style="background-image: url({picture}); width: 650px; height: 300px; padding: 50px 0 0 30px">
<xsl:if test="data [@alias = 'contentPicture'] != ''">
<div class="imageText" style="width: 400px; ">
<xsl:value-of select="contentPicture" disable-output-escaping="yes"/>
</div>
</xsl:if>
</div>
</li>
</xsl:for-each>
Kind regards from Denmark
// Mikkel Johansen
Inmedia
Hi Mikkel,
Since your if block is inside a foreach and you want to refer to the "current" image node, you'll want to use the current() XSLT function:
<xsl:if test="current()/data [@alias = 'contentPicture'] != ''">
Grtz
L
Hi Mikkel,
Am not sure i really understood what you asked but you can try chaning the your test to something like
Hi Mikkel,
The test you're performing uses the old XML Schema - you can do it like this:
/Chriztian
is working on a reply...