1 users online. Create an account or sign in to join them.Users
Using two datasources
This is an open discussion with 2 replies, filed under XSLT.
Search
Sounds like Data Source Chaining is what you want to check out. Set a parameter output in the feature data source and filter the other by it.
Cheers Lewis, exactly what I needed.
Create an account or sign in to comment.
I've been having a small headache within XSLT - although I have found the language intuitive.
** XML **
<resorts> <entry id="7000"> <name handle="resort-name">Some Name</name> <id handle="540">540</id> </entry> <!-- Lists all resorts name and ID --> </resorts> <featured-hotels> <entry id="418"> <name handle="hotel-name">Hotel Name</name> <id handle="670">670</id> <resort-id handle="540">540</id> </featured-hotels>** XSLT **
<xsl:template match="featured-hotels/entry"> <xsl:variable select="image" name="image"/> <xsl:variable select="stars" name="stars"/> <xsl:variable select="resort-id" name="resort-id"/> <xsl:variable select="resorts/entry/id[@handle = $resort-id]" name="class-id"/> <div class="hotel-container"> <h3><a href="/"><xsl:value-of select="name"/></a></h3> <div class="stars"><div class="yellow-stars yellow-stars-{$stars}"></div></div> <div class="resort"><a href="/<!--Resort Name [@handle] here -->"><!--Resort Name here --></a></div> <a href="/"> <div class="resort-photo" style="background: url('{$image}')" > <img src="{$workspace}/assets/images/photo-mask.png" /> </div> </a> </div> <xsl:if test="position() mod 3 = 0"> <hr class="space" /> </xsl:if> </xsl:template>** The Issue **
For now, please ignore 'class-id' variable as it was from a previous attempt, it isn't right.
I'm looking into how XSLT can take a value, in this instance 'featured-hotels/resort-id', then find the corresponding 'resorts/entry/name', which is equal to the resort-id (or resorts/entry/id).
It seems a bit overkill to-do a for-each through all resorts - returning the correct resort once found with an if statement. Am I right to believe XSLT has a better way to select the right resort?
Thanks for any suggestions.