0
嘿,我不能得到嵌入的Youtube視頻工作在XSLT出於某種原因。頁面可以正常加載所有數據,但由於某種原因,視頻不會嵌入。我嘗試更改源屬性,但導致整個XSLT無法加載,所以我在這裏遵循了一個解決方法http://our.umbraco.org/forum/developers/xslt/33745-Fixed-Youtube-embed-through-XSLT現在頁面可以正確加載嵌入。使用XSLT嵌入YouTube視頻,更改SRC屬性
這裏是我的XML:
<?xml version="1.0" encoding="UTF-8"?>
<dalehoward>
<bio>
<profilepic>profilepic.jpg</profilepic>
<dob>16/10/1987</dob>
<pob>Liverpool</pob>
<about>
English Deep House producer Dale Howard first burst onto the scene in 2009 with his debut EP on Neurotraxx Deluxe Gotta Be Deep, which topped the Beatport Deep House chart reaching the Number 1 spot. Since then he has been making waves with an array of releases on world renowned labels like Fear Of Flying, Loco Records and many others. Aswell as having countless top 20's and 50's Dale has also reached Number 2 and Number 3 on the Beatport Deep House Chart with his tracks 'Dropout' and 4 Hour Bang, which also stayed in the Top 10 for 9 weeks. In 2010 Dale launched his own imprint Static Audio, which is a hotbed for established and up and coming Deep and Tech House producers alike and features some of the biggest Deep House artists in the world. With his productions having support from artists like Richie Hawtin, Nic Fancuilli, Mark Knight, Florian Meindl, Funkagenda, Karol XVII and MB Valence, Ekkohaus, Robert Owens, Filthy Rich, Ronan Portela, Soul Miniority and a load more, Dale continues to make Top notch Deep House and has forthcoming releases on even more of the worlds finest House labels.
</about>
</bio>
<ep id="1">
<name>Letters EP</name>
<year>2012</year>
<label>Static Audio</label>
<image>letters.jpg</image>
<track number="1" beatportrank="0">
<tname>Letters</tname>
<length>6.35</length>
<ytubelink>https://www.youtube.com/watch?v=2H2XDQqvbpc</ytubelink>
</track>
<track number="2" beatportrank="0">
<tname>Later</tname>
<length>7.56</length>
<ytubelink>https://www.youtube.com/watch?v=w61RrgBPahk</ytubelink>
</track>
<track number="3" beatportrank="0">
<tname>'89 Flava</tname>
<length>7:38</length>
<ytubelink>https://www.youtube.com/watch?v=Mgarl-FlVhQ</ytubelink>
</track>
<track number="4" beatportrank="0">
<tname>Safe Presentation</tname>
<length>7.55</length>
<ytubelink>https://www.youtube.com/watch?v=d_U38G9AwHk</ytubelink>
</track>
</ep>
<ep id="2">
<name>Inner City EP</name>
<year>2012</year>
<label>Lost My Dog</label>
<image>innercity.jpg</image>
<track number="1" beatportrank="0">
<tname>C'Mon</tname>
<length>7.15</length>
<ytubelink>https://www.youtube.com/watch?v=Y9ExPTumGg4</ytubelink>
</track>
<track number="2" beatportrank="0">
<tname>Koppabird</tname>
<length>6.27</length>
<ytubelink>https://www.youtube.com/watch?v=RrSgPq9gw9E</ytubelink>
</track>
<track number="3" beatportrank="0">
<tname>Inner City</tname>
<length>8:50</length>
<ytubelink>https://www.youtube.com/watch?v=zuABxrp5A2U</ytubelink>
</track>
<track number="4" beatportrank="0">
<tname>You Can</tname>
<length>8:16</length>
<ytubelink>https://www.youtube.com/watch?v=oxFynevJf6Y</ytubelink>
</track>
</ep>
</dalehoward>
這裏是我的XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="imagefolder" select="'xml/images/'" />
<xsl:template match="/">
<html>
<body>
<table border="1px" bordercolor="#FFFFFF" width="100%">
<tr bgcolor="#cccccc">
<th style="text-align:left">Title</th>
<th style="text-align:left">Year</th>
<th style="text-align:left">Label</th>
<th style="text-align:left">Tracks</th>
<th style="text-align:left">Artwork</th>
</tr>
<xsl:for-each select="dalehoward/ep">
<xsl:sort select="year" order="ascending" data-type="number"/>
<xsl:if test="@id = 1">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="year"/></td>
<td><xsl:value-of select="label"/></td>
<td><xsl:for-each select="track">
<xsl:if test="../@id = 1">
<xsl:value-of select="@number"/>.
<xsl:value-of select="tname"/><br />
<xsl:value-of select="length"/> <br /><br />
<xsl:element name="iframe">
<xsl:attribute name="class">cf</xsl:attribute>
<xsl:attribute name="width">440</xsl:attribute>
<xsl:attribute name="height">260</xsl:attribute>
<xsl:attribute name="src"><xsl:value-of select="ytubelink"/></xsl:attribute>
<xsl:attribute name="frameborder">0</xsl:attribute>
<xsl:comment/>
</xsl:element> <br /><br />
</xsl:if>
</xsl:for-each></td>
<td><img width="150px" height="150px"><xsl:attribute name="src">
<xsl:copy-of select="$imagefolder"/>
<xsl:value-of select="image"/>
</xsl:attribute></img></td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
預先感謝收到任何幫助:)