XSLT: insert parameter value inside of an html attribute
Posted
by usr
on Stack Overflow
See other posts from Stack Overflow
or by usr
Published on 2010-05-06T13:01:54Z
Indexed on
2010/05/06
13:08 UTC
Read the original article
Hit count: 242
xslt
How to make the following code insert the youtubeId parameter:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:YouTube="urn:YouTube"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library YouTube">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="videoId"/>
<xsl:template match="/">
<a href="{$videoId}">{$videoId}</a>
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/{$videoId}&hl=en"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/{$videoId}&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed>
</object>$videoId {$videoId} {$videoId}
<xsl:value-of select="/macro/videoId" />
</xsl:template>
</xsl:stylesheet>
As you can see I have experimented quite a bit. <xsl:value-of select="/macro/videoId" />
actually outputs the videoId but all other occurences do not. This must be an easy question to answer but I just cannot get it to work.
© Stack Overflow or respective owner