Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2008, 07:23 PM   PM User | #1
kittleb
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kittleb is an unknown quantity at this point
XML/XSL Eternal Loading w/Flash in Firefox only

Hi All,
I've been scouring forums and the internet high and low for a solution to the problem I'm having and I can't seem to find anything that resolves my issue. Keep in mind that I'm really more of a designer/3Dartist and while I enjoy learning new code and its uses, I'm not an expert and currently do it as a means to an end, so perhaps I've missed something about how XSL runs.

I'm currently experimenting with the idea of converting a client's website to from basic HTML/CSS to XML data which is then processed and styled using XSL. The reason for this is that I would like the client to be able to edit any of the data and information on their site without needing to look at any code but still be able to edit basic information within the design structure that I already have set up. My plan is to create an easy to use Flash application which can be used to edit portions of the XML. From the tests I've run I've been able to get this working fine, but then comes the weird problems I've been having:

Inside my XSL sheet I've embedded an .SWF to act as an animated menu, and I've tested this before even bothering with XSL transformations just to see if it works. It works fine in IE (in multiple versions as well) but whenever I test it in Firefox, the page just loads for an indefinite amount of time. If I hit stop, and then refresh, the flash object shows up, but not within the context of the XSL or XML... the snippet of code is just sitting there all by it's lonesome.

Here is the testing page I'm using:
http://portfolio.bretkittle.com

XML:
Code:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="layout/index.xsl"?>
<thisPage>

<thisSection>
	<thisTitle></thisTitle>
	<thisPara>
	...to novelist Katie Estill's website. In the novel section you can find information about her novels Dahlia's Gone and Evening Would Find Me. 
	</thisPara>
</thisSection>

<thisSection>
	<thisTitle></thisTitle>
	<thisPara>
	Katie Estill has been nominated for the 2008 HAMMETT PRIZE for DAHLIA'S GONE by the North American Branch of the International Association of Crime Writers for a work of literary excellence in the field of crime writing by a US or Canadian author. 
	</thisPara>
</thisSection>

</thisPage>
XSL:
Code:
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="../index.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Untitled Document</title>
<link href="../css/style_01.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>

<div id="wrapper">

	<div id="container">
    	
        <div id="nav-main">
       	  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','700','height','120','src','../Header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../Header' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="700" height="120">
              <param name="movie" value="../Header.swf" />
              <param name="quality" value="high" />
              <embed src="../Header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="700" height="120"></embed>
      	  </object></noscript>
        </div>
    
    </div>

</div>

</body>
</html>

</xsl:template>
</xsl:stylesheet>
And thanks ahead of time for any light any of you can shed on this for me!
kittleb is offline   Reply With Quote
Old 08-30-2008, 07:39 PM   PM User | #2
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
try this, maybe help:
Code:
<?xml version="1.0" encoding="utf-8"?><!-- DWXMLSource="../index.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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Untitled Document</title>
<link href="../css/style_01.css" rel="stylesheet" type="text/css" />
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>

<body>

<div id="wrapper">

	<div id="container">
    	
        <div id="nav-main">
       	  <script type="text/javascript">
//<![CDATA[
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','700','height','120','src','../Header','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../Header' ); //end AC code
//]]></script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="700" height="120">
              <param name="movie" value="../Header.swf" />
              <param name="quality" value="high" />
              <embed src="../Header.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="700" height="120"></embed>
      	  </object></noscript>
        </div>
    
    </div>

</div>

</body>
</html>

</xsl:template>
</xsl:stylesheet>
you can use xsl : comment instead of //

Edit: I guess the problem could be in head section, probably the script element

best regards

Last edited by oesxyl; 08-30-2008 at 07:46 PM..
oesxyl is offline   Reply With Quote
Old 08-30-2008, 08:01 PM   PM User | #3
kittleb
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kittleb is an unknown quantity at this point
Hmmm, that's interesting, because the script is just a basic Dreamweaver Script made by Adobe that gets included whenever you embed the SWF. Would you like me to include the main AC_RunActiveContent.js Script?

I am just now looking through the AC_RunActiveContent Script, and I notice that there is not a specific inclusion of a var for Mozilla or Firefox. Yet there is one for IE and Opera... do you think I need to write my own script specifically for Firefox?

Code:
//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

Last edited by kittleb; 08-30-2008 at 08:10 PM.. Reason: there was a typo on my part, so nm, the change you added still leaves it loading forever
kittleb is offline   Reply With Quote
Old 08-30-2008, 08:14 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by kittleb View Post
Hmmm, that's interesting, because the script is just a basic Dreamweaver Script made by Adobe that gets included whenever you embed the SWF. Would you like me to include the main AC_RunActiveContent.js Script?

When I included that change that you added it no longer continues to load forever, but it also doesn't load the swf file.
the problem is in head section!!!!!
check the js file, maybe is corrupt or broken. If you look to the page with firebug will see the head like <head/> and that means is empty.

bets regards.
oesxyl is offline   Reply With Quote
Old 08-31-2008, 01:29 AM   PM User | #5
kittleb
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kittleb is an unknown quantity at this point
I'm pretty sure you're right. Because If I take out the script (i have to take the flash file out too, it requires the script to run) it works. This doesn't seem to make any sense because I use the exact same code and exact same script in HTML files all the time on my own website

I'm bewildered and don't quite know what to make of it. I'm gonna go see if I can get some info on the script from Adobe's forums.

Thanks for your help!
kittleb is offline   Reply With Quote
Old 08-31-2008, 01:56 AM   PM User | #6
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by kittleb View Post
I'm pretty sure you're right. Because If I take out the script (i have to take the flash file out too, it requires the script to run) it works. This doesn't seem to make any sense because I use the exact same code and exact same script in HTML files all the time on my own website

I'm bewildered and don't quite know what to make of it. I'm gonna go see if I can get some info on the script from Adobe's forums.

Thanks for your help!
no, seems I was wrong. It's a server problem, more exactly a redirection problem:
Code:
HTTP/1.1 200 OK
Content-Length: 339
Content-Type: text/html
Content-Location: http://portfolio.bretkittle.com:80/index.html
Last-Modified: Sat, 30 Aug 2008 16:16:18 GMT
Accept-Ranges: bytes
ETag: "422037bcbbac91:1d37"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
MicrosoftOfficeWebServer: 5.0_Pub
Date: Sun, 31 Aug 2008 00:49:48 GMT
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="0; url=http://portfolio.bretkittle.com/index.xml" />
<title>Untitled Document</title>
</head>

<body>
</body>

</html>
since I have no idea how IIS work, I could not help, I'm sorry.

best regards
oesxyl is offline   Reply With Quote
Old 08-31-2008, 02:14 AM   PM User | #7
kittleb
New to the CF scene

 
Join Date: Aug 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
kittleb is an unknown quantity at this point
Oh wow, hey thanks a lot! This at least points me in the right direction to know that the problem is with my server so that I can contact my host admin and get it figured out. Thanks a lot!
kittleb is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:54 AM.


Advertisement
Log in to turn off these ads.