Rank: Newbie
Joined: 8/18/2008 Posts: 21 Location: bangalore
|
Hi All,
As I want to get corresponding image of a particualr product,I tried a lot but i didnt find any solution,anyone can help me plz? Actually the Issue is,For suppose if we have a list of products i.e., cars like Ford,Esteem,BMW,Honda City,we have to get the respective images of the products.
as my code is:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:math="urn:schemas-hizi-nl:math" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" exclude-result-prefixes="msxml Exslt.ExsltMath Exslt.ExsltStrings math umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="numberOfItems" select="count($currentPage/ancestor-or-self::root//node)"/> <!--count of total pages--> <xsl:variable name="ItemSeperator" select="1"/>
<msxml:script language="JavaScript" implements-prefix="math"> function random(numDie,numMax,numMin){ if (numMin==null){numMin=1;} var sum=0; for (var index=0;index<numDie;index++){ sum+=Math.floor(Math.random()*(numMax-numMin) + numMin); } return "" + sum; } function floorme(numFloor){ return "" + Math.floor(numFloor); } </msxml:script> <xsl:variable name="parent" select="umbraco.library:GetMedia(1040, false())" /> <xsl:variable name="random" select="math:random(1, count($parent/node)+1, 1)"/>
<xsl:template match="/"> <div class="Layout_Content_Holder"> <!-- The fun starts here --> <xsl:for-each select="$currentPage/ancestor-or-self::root//node[string(data [@alias='ShowInProducts']) = '1']"> <xsl:sort select="@createDate" order="descending"/> <xsl:if test="position() <= $numberOfItems">
<div class="IntroBox_3"><div class="YSpace" style="height: 5px; "> </div> <a><img src="../media/2946/ford.jpg" alt="images" /></a> <div class="XSpace" style="height: 13px; "> </div> <div class="YSpace" style="height: 5px; "> </div> <div class="XSpace" style="height: 13px; "> </div> <div style="height: 39px;float : left; " class="ReplaceText_3 Minus_35" onmouseover="this.className='ReplaceText_4 Minus_35'" onmouseout="this.className='ReplaceText_4 Minus_35'" onclick="location.href='{umbraco.library:NiceUrl(@id)}'"> <a href="{umbraco.library:NiceUrl(@id)}" style="font-size: 34px; "><xsl:value-of select="@nodeName"/></a> </div> <div class="XSpace" style="height: 5px; "> </div>
<div class="XSpace"> </div> <div style="float: left; height: 25px; " class="White_Arrow_Small ReplaceText_4 Minus_5" onmouseover="this.className='Red_Arrow_Small ReplaceText_4 Minus_5'" onmouseout="this.className='White_Arrow_Small ReplaceText_4 Minus_5'" onclick="location.href='{umbraco.library:NiceUrl(@id)}'"> <a href="{umbraco.library:NiceUrl(@id)}" style="font-size: 20px; ">Experienc<div>e</div></a> </div> </div> <xsl:if test="position() mod 3 = 0"> <div class="XSpace" style="height: 5px; "> </div> <div class="HrBox"> </div> <div class="XSpace" style="height: 13px; "> </div> </xsl:if> </xsl:if>
</xsl:for-each> </div>
</xsl:template>
</xsl:stylesheet>
if we specify one image address then it will work fine,but it has to pick from media according to that product
Thanks In Advance
Thanks & Regards, Ammu
|
 Rank: Umbracoholic
Joined: 9/8/2006 Posts: 1,831 Location: MA, USA
|
This is a cross-post. Please see http://forum.umbraco.org/yaf_postsm29249_Getting-corresponding-images-for-selected-products.aspx, where it is being discussed. @Ammu... in future, please do not cross-post. The forum isn't that big. Your post will be seen. cheers, doug.
MVP 2007-2009 - Percipient Studios
|