Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi Guys,
Am having some issues with an if statement while using a xslt from changeable source. Here am checking one of my field is empty and if not i will display the link so as the user can download it.
But doesnt seem to work.
<xsl:variable name="pdfFile" select="$currentPage/newsPDF" />
<ul class="eventList"><xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="current()/eventDate" order="descending"/> <!-- <xsl:if test="position () <= $itemsToDisplay">--> <li class="eventLink"> <h1><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="newsTitle"/> </a></h1> </li> <li style="padding-left:15px; "> <xsl:value-of select="newsImg"/> <xsl:value-of select="newsDescription"/> <xsl:if test="$pdfFile != ''"> <xsl:element name="a"> <xsl:attribute name="href"> <xsl:value-of select="newsPDF"/> </xsl:attribute>Download the file </xsl:element> </xsl:if> </li> </xsl:for-each></ul>
//fuji
Hey Fuji,
I think the problem is you are defining your $pdfFile variable for the $currentPage, instead of each item in the loop.
Try instead moving it inside your for-each, and removing $currentPage
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="current()/eventDate" order="descending"/> <xsl:variable name="pdfFile" select="newsPDF" />
-Tom
Hi Tom,
Yup its working now....but earlier I try using @alias=newsPDF which works at and at some point when i added the attributes i all when wrong...
Am getting so confused with the strcuture of this website and am already @ 150 pages!!!
But Thanks again
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Checking if a field is empty in XSLT
Hi Guys,
Am having some issues with an if statement while using a xslt from changeable source. Here am checking one of my field is empty and if not i will display the link so as the user can download it.
But doesnt seem to work.
<xsl:variable name="pdfFile" select="$currentPage/newsPDF" />
<ul class="eventList">
<xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort select="current()/eventDate" order="descending"/>
<!-- <xsl:if test="position () <= $itemsToDisplay">-->
<li class="eventLink">
<h1><a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="newsTitle"/> </a></h1>
</li>
<li style="padding-left:15px; ">
<xsl:value-of select="newsImg"/>
<xsl:value-of select="newsDescription"/>
<xsl:if test="$pdfFile != ''">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="newsPDF"/>
</xsl:attribute>Download the file
</xsl:element>
</xsl:if>
</li>
</xsl:for-each>
</ul>
//fuji
Hey Fuji,
I think the problem is you are defining your $pdfFile variable for the $currentPage, instead of each item in the loop.
Try instead moving it inside your for-each, and removing $currentPage
-Tom
Hi Tom,
Yup its working now....but earlier I try using @alias=newsPDF which works at and at some point when i added the attributes i all when wrong...
Am getting so confused with the strcuture of this website and am already @ 150 pages!!!
But Thanks again
//fuji
is working on a reply...