Jump to content

Need Help Using Xslt And Xml To Load Smugmug Photo Galleries


richardbrackin

Recommended Posts

I'm working on tweaking a website for a school who has a staff member handling the videos and photos. The videos and photos are hosted at smugmug and are fed back to the site via Flash.I've got it set up so they use XML and XSL to dynamically place the video (and hopefully photo) galleries.It's easier for them to just upload an XML file than to edit html.I have had success doing this with the smugmug video code but the slideshow gallery code is formatted a little different and is causing problems.I think it has to do with properly handling all the quotes and ampersands in their code but I'm not sure.So I took my XSL file that works with video and adjusted it to handle the photos. It's not working; blank screen.Here is the relevant XSLT code: This portion is at the top of the XSLT page (using Dreamweaver)

<?xml version="1.0" encoding="UTF-8"?><!-- DWXMLSource="photo_feature.xml" --><!DOCTYPE xsl:stylesheet  [	<!ENTITY nbsp   " ">	<!ENTITY copy   "©">	<!ENTITY reg	"®">	<!ENTITY trade  "™">	<!ENTITY mdash  "—">	<!ENTITY ldquo  "“">	<!ENTITY rdquo  "”"> 	<!ENTITY pound  "£">	<!ENTITY yen	"¥">	<!ENTITY euro   "€">]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" encoding="UTF-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml">

then here is the relevant text in the body section.There are two lines in question. <param name="flashvars" value="AlbumID='{album_id}'&AlbumKey='{album_key}'&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com">and<embed src="http://www.smugmug.com/ria/ShizamSlides-2007090601.swf" flashvars="AlbumID='{album_id}'&AlbumKey='{album_key}'&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com"wmode="transparent" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" height="561" width="840"></embed>Please notice I have placed '{album_id}' and '{album_key}' in the places where I'm trying to bring in the info from the xml file.This is what I need help with.

<div class="fullwide" id="primary_text"><xsl:for-each select="photos/item"><xsl:sort select="summary" data-type="text" order="ascending" />	<div id="photo_xsl_container">		<span class="blue_bar center" id="bio_row"><h2><xsl:value-of select="summary" /></h2></span>				<div id="photo_xsl">		<object height="561" width="840"><param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007090601.swf"><param name="flashvars" value="AlbumID='{album_id}'&AlbumKey='{album_key}'&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com"><param name="wmode" value="transparent"><param name="bgcolor" value="000000"><param name="allowNetworking" value="all"><param name="allowScriptAccess" value="always"><embed src="http://www.smugmug.com/ria/ShizamSlides-2007090601.swf" flashvars="AlbumID='{album_id}'&AlbumKey='{album_key}'&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com"wmode="transparent" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" height="561" width="840"></embed></object>		</div>	</div>	</xsl:for-each></div>

And here is some of the XML code

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="photo_feature.xsl" type="text/xsl"?><photos>	<item id="1" classification="trip">		<summary>Williamsburg</summary>		<detail>See what makes Mars Hill special.</detail>		<album_id>11066743</album_id>		<album_key>m3sFZ</album_key>	</item>	<item id="2" classification="reunion">		<summary>Reunion 1969</summary>		<detail>Class Reunion</detail>		<album_id>10590103</album_id>		<album_key>T2NJA</album_key>	</item>	<item id="3" classification="athletics">		<summary>8th Grade Bous Basketball</summary>		<detail>8th Grade Bouys Basketball</detail>		<album_id>10582455</album_id>		<album_key>8uTTQ</album_key>	</item>	<item id="4" classification="academics">		<summary>Accelerated Reading</summary>		<detail>Accelerated Reading</detail>		<album_id>10926598</album_id>		<album_key>WAMEK</album_key>	</item>	<item id="5" classification="finearts">		<summary>Band Fall Concert</summary>		<detail>Band Fall Concert</detail>		<album_id>11051365</album_id>		<album_key>XTKLq</album_key>	</item></photos>

I can supply the entire code if it will help and even give you the link to the site but all it shows is a blank white page.I appreciate any help you can provide.

Link to comment
Share on other sites

You're right. The problem is the ampersands (and double quotes, if any) in the URLs. You need to explicitly escape them to

&

Link to comment
Share on other sites

Thank you. Got it working. I had to do several things so I thought I'd fill in the parts I missed.Indeed, I added & for all ampersands.Then I closed out each <param> tag with a spacebar and a slash: Then I removed the apostraphe surrounding each '{album_id}' and key.Here's the correct code that finally started working.Thank you for your prompt help.

<div class="fullwide" id="primary_text"><xsl:for-each select="photos/item"><xsl:sort select="summary" data-type="text" order="ascending" />	<div id="photo_xsl_container">		<span class="blue_bar center" id="bio_row"><h2><xsl:value-of select="summary" /></h2></span>				<div id="photo_xsl">		<object height="561" width="840"><param name="movie" value="http://www.smugmug.com/ria/ShizamSlides-2007090601.swf" /><param name="flashvars" value="AlbumID={album_id}&AlbumKey={album_key}&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com" /><param name="wmode" value="transparent" /><param name="bgcolor" value="000000" /><param name="allowNetworking" value="all" /><param name="allowScriptAccess" value="always" /><embed src="http://www.smugmug.com/ria/ShizamSlides-2007090601.swf" flashvars="AlbumID={album_id}&AlbumKey={album_key}&transparent=true&crossFadeSpeed=500&clickUrl=http://www#46;smugmug#46;com"wmode="transparent" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all" height="561" width="840"></embed></object>		</div>	</div>	</xsl:for-each></div>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...