Actually, you should be able to use the same predicate on that statement because apply-templates sets the current node list, which is where position() is calculated from:
Regarding the tags stuff, the client can only select 1 tag at the moment. But it will be possible to select multiple later on, but right now it's not possible to select multiple documents as a macro parameter. All tags are created as documents in the tree.
Filtering with keys and position()
Any ideas how to combine position and keys.
I have some documents that are tagged and I find the tagged documents using keys like this:
<xsl:key name="filtred_news" match="News" use="tags/XPathCheckBoxList/nodeId"/> <xsl:param name="currentPage"/> <xsl:template match="/"> <xsl:apply-templates select="$currentPage/ancestor-or-self::Frontpage/Newslist"> <xsl:with-param name="tags" select="macro/tags" /> <xsl:with-param name="items" select="macro/items" /> </xsl:apply-templates> </xsl:template> <xsl:template match="Newslist"> <xsl:param name="tags" /> <xsl:param name="items" /> <ul class="news"> <xsl:choose> <xsl:when test="string-length($tags) > 0"> <xsl:apply-templates select="key('filtred_news',$tags)" /> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="descendant::News[position() <= $items]" /> </xsl:otherwise> </xsl:choose> </ul> </xsl:template>
If you see in the otherwise apply, I limit the number of outputs to 5 using a macro parameter.
How do I do the same when using keys ?
Hi Sebastian,
Actually, you should be able to use the same predicate on that statement because apply-templates sets the current node list, which is where position() is calculated from:
I'm a little curious as to how the $tags parameter will work when there's more than one tag in there - does that do what you expect?
/Chriztian
Thought I tried that ... but apparently not ;)
Regarding the tags stuff, the client can only select 1 tag at the moment. But it will be possible to select multiple later on, but right now it's not possible to select multiple documents as a macro parameter. All tags are created as documents in the tree.
At that time it will need a remake.
is working on a reply...