I have just started trying to get my head around Symphony and XML/XSL based templating etc (I don't even know the correct terminology so forgive me).
I have a Videos section in Symphony, and one of the Input fields is for a YouTube URL. I obviously can't just write <a href="<xsl:value-of select="youtube-url"/>">Video</a>
but I'm really not sure how it SHOULD be done.
I did some Googling and found that xml/xsl or whatever supports variables so I thought that was a good shout, but as you can see in my code example below, whatever I have done, it has failed. Maybe I'm just using variables wrong? I don't know.
I just need my Youtube-URL to be in the space that I currently have {$youtube}
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="../utilities/master.xsl"/>
<xsl:variable name="youtube">
<xsl:value-of select="youtube-url"/>
</xsl:variable>
<xsl:template match="data">
<div class="video-container">
<xsl:apply-templates select="videos/entry"/>
</div>
</xsl:template>
<xsl:template match="videos/entry">
<div class="video">
<div class="video-title"><xsl:value-of select="title"/></div>
<div class="video-player">
{$youtube}
</div>
<div class="video-desc"><xsl:value-of select="description"/></div>
</div>
</xsl:template>
</xsl:stylesheet>
You can't write
<a href="<xsl:value-of select="youtube-url"/>">Video</a>
but you can write
<a href="{youtube-url}">Video</a>
or
<a href="{$youtube}">Video</a>
That's an attribute value template.
It only works in within attributes, though. You cannot use it in other text. (something like <div class="video-player">{$youtube}</div>
will not work - use <xsl:value-of>
instead.)