Maybe you need to use the muenchian method to do this...but let's see what the current XSLT looks like and then it will be much more easy to guide you in the right direction. It can be done for sure :-)
I tried to delete this post, because I forgot to include the Xslt I was working on, but editing that post to include the Xslt generated an xslt error. I noticed that currently no forum posts can be edited on the our.umbraco.org forum
But deleting this forum also didn't work.
I created another forum post, this time with the xslt code included.
I got help from Tom Fulton, which solved the problem. He also suggested to take a look in the muenchan methods. The Xslt code he provided me looks like this:
That code perfectly works for the scenario I tried to implement. I just had to add some markup and some <xsl:if> statements to conditionally show output:
sorting links per country in xslt
Hi,
I'm currently implementing a Links page. The links shoud be listed and sorted by country.
Therefore I created a Link Item document type, and I created a linkCountry datatatype of type uComponent Country Picker.
Does anyone know how I can list the links per country?
Something like this:
Egypt
link 1
link 2
link 3
Iran
link 1
link 2
link3
etc...
I already created a for-each loop that loops through alll links, but now I need to implement the sort by country
Does anyone knows how to do this with Xslt ?
Thanks for your help,
Anthony Candaele
Belgium
Hi Anthony
What does your current XSLT file look like?
Maybe you need to use the muenchian method to do this...but let's see what the current XSLT looks like and then it will be much more easy to guide you in the right direction. It can be done for sure :-)
/Jan
Hi Jan,
I tried to delete this post, because I forgot to include the Xslt I was working on, but editing that post to include the Xslt generated an xslt error. I noticed that currently no forum posts can be edited on the our.umbraco.org forum
But deleting this forum also didn't work.
I created another forum post, this time with the xslt code included.
I got help from Tom Fulton, which solved the problem. He also suggested to take a look in the muenchan methods. The Xslt code he provided me looks like this:
That code perfectly works for the scenario I tried to implement. I just had to add some markup and some <xsl:if> statements to conditionally show output:
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:key name="country" match="LinkItem [@isDoc]" use="linkCountry"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:apply-templates select="$currentPage/LinkItem [generate-id() = generate-id(key('country', linkCountry)[1])]" mode="country"/>
</xsl:template>
<xsl:template match="LinkItem [@isDoc]" mode="country">
<h2><xsl:value-of select="linkCountry"/></h2>
<xsl:apply-templates select="$currentPage/LinkItem [linkCountry = current()/linkCountry]" mode="link"/>
</xsl:template>
<xsl:template match="LinkItem [@isDoc]" mode="link">
<p class="tekst"><a href="{linkUrl}" class="tekstLink" title="{linkTitle}">
<xsl:if test="linkTarget = 'Open link in new window'">
<xsl:attribute name="target">_blank</xsl:attribute>
</xsl:if>
<xsl:value-of select="linkTitle"/>
</a></p>
<p class="tekst"><xsl:value-of select="linkDescription"/></p>
</xsl:template>
is working on a reply...