Hi, I have a small product catalogue and I have created a doctype for product pages which includes alias properties "productThumbnail", "productImage", "productTitle" and "productDescription".
On the parent product listing page I am trying to write xslt based on the List sub pages as thumbnails" xslt. I've tried modifications but no matter what I do it won't show any images.
Did you manage to solve your problem? I'm about to start creating a very similar type of catalog for a site I'm working on and wondered what your final XSLT code ended up being. I took a look at your sample site which looks like just the kind of model I need. Can you post the XSLT you are using if it is working as I think it might be helpful to me.
The second example is using the old schema, but the first example is using the new XML schema. Have a look in your web.config file to the setting "umbracoContentXML" and this will tell you where to find the data file. If the data file has entries like: <data alias="bodyText"> it is the old schema, if there are entries like <bodyText>zxczxcz</bodyText> it is the new schema.
In the first example, where you have:
<!-- get first photo thumbnail -->
If you write:
XX=<xsl:copy-of select="."/>
You will see the XML within the loop and this should help point you as to why you are not getting any output.
Thanks for your help. I have finally got it working...using the following, where "productThumbnail" is the name of the property with a contentPicker type:
<!-- The fun starts here --> <xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <div class="photo"> <!-- get first photo thumbnail --> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:if test="productThumbnail != ''"> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia(productThumbnail,true())/umbracoFile"/> </xsl:attribute> </xsl:element> </xsl:if> <br/> <b><xsl:value-of select="@nodeName"/></b><br/> </a> </div> </xsl:for-each>
List sub pages as thumbnails not showing images
Hi, I have a small product catalogue and I have created a doctype for product pages which includes alias properties "productThumbnail", "productImage", "productTitle" and "productDescription".
On the parent product listing page I am trying to write xslt based on the List sub pages as thumbnails" xslt. I've tried modifications but no matter what I do it won't show any images.
The sample site is at http://charvo.penninedata.com/charvo-ltd/products/
and the xslt i'm currently using 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:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:CWS.Twitter="urn:CWS.Twitter"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CWS.Twitter ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<!-- The fun starts here -->
<xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']">
<div class="photo">
<!-- get first photo thumbnail -->
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:if test="count(./* [@isDoc]) > 0">
<img src="{concat(substring-before(./*/umbracoFile,'.'), '_thumb.jpg')}" style="border: none;"/><br/>
</xsl:if>
<b><xsl:value-of select="@nodeName"/></b><br/>
</a>
<xsl:value-of select="count(./* [@isDoc])"/> Photo(s)
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I've also tried using the following code, which I thought would make more sense (not being an xslt guru), but doesn't display anything.
<xsl:template match="/">
<!-- The fun starts here -->
<!-- [string(data [@alias='umbracoNaviHide']) != '1'] -->
<xsl:for-each select="$currentPage/node [@isDoc and string(umbracoNaviHide) != '1']">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:GetMedia(data[@alias='productThumbnail'], 'false')/data[@alias = 'umbracoFile']"/>
</xsl:attribute>
</xsl:element>
<!-- get first product thumbnail -->
<a href="{umbraco.library:NiceUrl(@id)}">
<b><xsl:value-of select="@nodeName"/></b>
</a>
</xsl:for-each>
</xsl:template>
Hi Rory,
Did you manage to solve your problem? I'm about to start creating a very similar type of catalog for a site I'm working on and wondered what your final XSLT code ended up being. I took a look at your sample site which looks like just the kind of model I need. Can you post the XSLT you are using if it is working as I think it might be helpful to me.
Thanks
Adam
Rory,
The second example is using the old schema, but the first example is using the new XML schema. Have a look in your web.config file to the setting "umbracoContentXML" and this will tell you where to find the data file. If the data file has entries like: <data alias="bodyText"> it is the old schema, if there are entries like <bodyText>zxczxcz</bodyText> it is the new schema.
In the first example, where you have:
<!-- get first photo thumbnail -->
If you write:
XX=<xsl:copy-of select="."/>
You will see the XML within the loop and this should help point you as to why you are not getting any output.
Richard
Thanks for your help. I have finally got it working...using the following, where "productThumbnail" is the name of the property with a contentPicker type:
Hope this helps someone else...
cheers
Rory
is working on a reply...