<xsl:iftest="string-length($currentPage/tags) > 0"><!-- SHOW TAGS INDIVIDUALY AND AS LINKS --><xsl:iftest="string-length($currentPage/tags) > 0"><divclass="tags"><p>Tags:
<xsl:variablename="items"select="umbraco.library:Split($currentPage/tags,',')"/><xsl:for-eachselect="$items//value"><ahref="/tag?filterby={current()}"><xsl:value-ofselect="current()"/></a></xsl:for-each></p></div></xsl:if></xsl:if>
But, is it maybe possible to tweak this so that i can find based based on multiple tags?
Not sure I understand the concept... Is it you click on a tag and see the corresponding pages. Then you click on another tag so you now search for pages maching both (or just one?) of the selected tags?
It's actually not how to make the user select tags - it's how to make the XSLT show results for more tags.
Right now i can only search for 1 tag, in this case "candy", by making this query: tag?filterby=candy
I would like to show results for a search of multiple tags, in this case "candy" and "cake", which would be something like this query: tag?filterby=candy,cake (this is what he did in the razor: http://daniel.streefkerkonline.com/tagging-and-umbraco/))
Example:
Product 1, tagged with: candy Product 2, tagged with cake Product 3, tagged with candy & cake
In 1 tag search i would like to be able to get all 3 products - which i can't at the moment. (I can get Product 1+3 with the candy-tag, or Product 2+3 with cake-tag)
Thanks so much for your help - much appreciated and just what I needed to make it work. below my final and working code
<!-- Query-string in the browser -->
<xsl:variable name="filter" select="umbraco.library:RequestQueryString('filter')"/>
<!-- run a for-each to split the tags -->
<xsl:for-each select="umbraco.library:Split($filter, ',')/value">
<!-- Save the values in a variable -->
<xsl:variable name="ct" select="."/>
<!-- Run a for-each to over the nodes we want to "search" -->
<!-- We will look for pages underneath node id 1061 - change this to fit your hierachy -->
<xsl:for-each select="umbraco.library:GetXmlNodeById(1061)/descendant-or-self::*">
<!-- Check if our variable is not empty -->
<xsl:if test="$ct != ''">
<!-- Check to if any of these pages contains the tags from our ct-variable -->
<xsl:if test="contains(tags, $ct)">
<!-- Product name -->
<xsl:value-of select="nodeName" />
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
Show related pages based on multiple tags
Hi,
I have a working solution where i can find related pages based on a tag .
The tag could be "candy", like this: http://localhost:28192/en/tag?filterby=candy
Then this XSLT kicks in
But, is it maybe possible to tweak this so that i can find based based on multiple tags?
Like "candy" and "cake", like this: http://localhost:28192/en/tag?filterby=candy,cake
I've seen this done in Razor (http://daniel.streefkerkonline.com/tagging-and-umbraco/), but I would like to keep this in XSLT
Any help appreciated.
best regards, Brian
Anyone? :)
Not sure I understand the concept... Is it you click on a tag and see the corresponding pages. Then you click on another tag so you now search for pages maching both (or just one?) of the selected tags?
It's actually not how to make the user select tags - it's how to make the XSLT show results for more tags.
Right now i can only search for 1 tag, in this case "candy", by making this query: tag?filterby=candy
I would like to show results for a search of multiple tags, in this case "candy" and "cake", which would be something like this query: tag?filterby=candy,cake (this is what he did in the razor: http://daniel.streefkerkonline.com/tagging-and-umbraco/))
Example:
Product 1, tagged with: candy
Product 2, tagged with cake
Product 3, tagged with candy & cake
In 1 tag search i would like to be able to get all 3 products - which i can't at the moment. (I can get Product 1+3 with the candy-tag, or Product 2+3 with cake-tag)
Aha... I don't have a plug'n'play solution (don't have more time today). But maybe this concept can get you startet:
Hi Kasper,
Thanks so much for your help - much appreciated and just what I needed to make it work. below my final and working code
is working on a reply...