I WANT TO INSERT AND IF OR CHOOSE STATEMENT HERE.. <div class="prdButtDownload"><a href="{productDocument}" target="_blank"><img src="images/butt_download_details.png" width="117" height="21" alt="Download Details" /></a></div>
No it doesn't work for me...it just hiding all the div class="prdButtDownload" ..even those with uploaded data in the upload fields..i tried to redo the upload again after putting the code and republish entire site but in vain...
As Jan's post, It will check if the currentpage's productdocument has value or not. I'm using the same case to check value and works but there may be some situation like to check value in for each. So could you please post your some xslt, so we can fiqure out your problem?
I guess you're inside some kind of loop in your code because you're not using $currentPage anywhere, so you might want to remove the $currentPage/ from Jan's code. I mean change the if to this:
Check if upload field has been fill in XSLT
Hi all,
I have created an upload field for the editor having the opportunity to download a pdf when clicked on a image button..
What i want to do is in XSLT using new shema coding, check if upload field contains data and show the div sontaining the button, else hide div.
I was wondering how to code this..
My Code
<div class="prdBox1">
<div class="prdImg"><img src="{productPhoto}" width="180" height="140" alt="{@nodeName}" /></div>
<div class="prdName"><xsl:value-of select="productName"/></div>
</div>
<div class="prdBox2">
<div class="prdDesc"><xsl:value-of select="productDescription" disable-output-escaping="yes"/></div>
<div class="prdButtons">
I WANT TO INSERT AND IF OR CHOOSE STATEMENT HERE..
<div class="prdButtDownload"><a href="{productDocument}" target="_blank"><img src="images/butt_download_details.png" width="117" height="21" alt="Download Details" /></a></div>
</div>
</div>
THKS
Hi Sam
In order to fetch the data from the upload field you can create a XSLT macro that looks like this
<xsl:if test="$currentPage/productDocument !=''">
<div class="prdButtDownload"><a href="{productDocument}" target="_blank"><img src="images/butt_download_details.png" width="117" height="21" alt="Download Details" /></a></div>
</xsl:if>
Does this work for you?
/Jan
Hi Jan,
No it doesn't work for me...it just hiding all the div class="prdButtDownload" ..even those with uploaded data in the upload fields..i tried to redo the upload again after
putting the code and republish entire site but in vain...
Any other thoughts?
Hi Sam,
As Jan's post, It will check if the currentpage's productdocument has value or not. I'm using the same case to check value and works but there may be some situation like to check value in for each. So could you please post your some xslt, so we can fiqure out your problem?
Thanks
Pnima
Hi Sam
I guess you're inside some kind of loop in your code because you're not using $currentPage anywhere, so you might want to remove the $currentPage/ from Jan's code. I mean change the if to this:
/Kim A
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:sort order="descending" select="@createDate"/>
<div class="prdLt">
<xsl:if test="string(./productNew) = '1'">
<xsl:element name="div">
<xsl:attribute name="class">prdTagNew</xsl:attribute>
</xsl:element>
</xsl:if>
<div class="prdBox1">
<div class="prdImg"><img src="{productPhoto}" width="180" height="140" alt="{@nodeName}" /></div>
<div class="prdName"><xsl:value-of select="productName"/></div>
</div>
<div class="prdBox2">
<div class="prdDesc"><xsl:value-of select="productDescription" disable-output-escaping="yes"/></div>
<div class="prdButtons">
<xsl:if test="productDocument !=''">
<xsl:element name="div">
<xsl:attribute name="class">prdButtDownload</xsl:attribute>
<a>
<xsl:attribute name="href"><xsl:value-of select="productDocument"/></xsl:attribute>
<xsl:attribute name="target">blank</xsl:attribute>
<img src="images/butt_download_details.png" width="117" height="21" alt="Download Details" />
</a>
</xsl:element>
</xsl:if>
<div class="prdButtAdd"><a href="#"><img src="images/butt_add_basket.png" width="107" height="21" alt="Add to Basket" /></a></div>
</div>
</div>
</div>
</xsl:for-each>
</xsl:template>
Great to see that you got it solved Sam!
Have a nice weekend...
/Kim A
Ah yeah, should have thought of that scenario...I just provided the method to do the check :-)
/Jan
is working on a reply...