I have a product feed with around 500 products in it, I am using this to load into e-mails. I load this feed from a feed management tool into my XSLT and I want to choose only specific items that all have the value 'test1' in the field 'visibility' (would be around 35 items), but then I only want to load 3 items. So 500 products in total in the feed - 35 with the value 'test1' in the field 'visibility' and output would be only 3 (with additional sort of price low - high).
I was able to either choose the products with the specific field OR choose only 3 products. But never both rules in one.
I tried the following:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="items">
<!-- start the items -->
<xsl:call-template name="item" />
</xsl:template>
<xsl:template name="item">
<xsl:for-each select="item">
<xsl:sort select="price" order="ascending"/>
<xsl:choose>
<xsl:when test="visibility = 'test1'">
<xsl:if test="(position() <= 3)">
The output doesn't show any products though. Apart from each other, they do work. I also tried to first use the IF and then the choose / when rules, but that did not work either.
I did see that people were using rules in the for-each function, but I don't know how that works (I am not a developer, only an online marketing consultant).
For that I tried
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="items">
<!-- start the items -->
<xsl:call-template name="item" />
</xsl:template>
<xsl:template name="item">
<xsl:for-each select="item and LogResults/Result[visibility='copernica']">
<xsl:sort select="price" order="ascending"/>
<xsl:choose>
<xsl:when test="position() <= 4">
But that did not work either, I always get runtime errior or error element for each.
I hope someone can help me out!