[XSLT] Sort entries by referencing another set of items
This is an open discussion with 1 reply, filed under XSLT.
Search
Do it the other way round. Select all images from your article first:
<xsl:template match="articles-index/entry"> <xsl:apply-templates select="images/item"/> </xsl:template>
then fetch all the images from the images DS:
<xsl:template match="images/item"> <xsl:apply-templates select="/data/images-by-id/entry[@id = current()/@id]" /> </xsl:template>
And display the way you like:
<xsl:template match="images-by-id/entry"> these are now sorted by their appearance in `images/item` </xsl:template>
Create an account or sign in to comment.
Let's take a SBL+ field (say
Images
) insideArticles
section and anImages
DS with a filter set on System ID with the SBL+ output.Currently I have this XSLT to select the images in order to display:
This iterates through the
Images by ID
datasource entries and displays the ones matched byImages
field from eachArticle
.Given that the new SBL+ allows sorting of related items, the items in the output of SBL+ fields are arbitrary sorted. I want to take advantage of this so I'm using this XSLT to respect this order:
This iterates through the items from
Images
field and displays the ones that are found inImages by ID
datasource. This is the best I have so far ... Is there a way to set the sorting ofimages-by-id/entry
elements regardingimages/item
? Something like:Thanks.