This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Xalan Transformation Error


Hello,
I have the following xsl stylesheet. When I include the namespace www.w3.org/TR/WD-xsl and use IE browser the form display properly. When I change the namespace to 1999/XSL/Transform and use Xalan to transform the document I get "INVALID TYPE ERROR!!!!!!! " hidden"
INVALID TYPE ERROR!!!!!! "text"

I am new to xml and xsl and this is my first project. I am trying to get this to run from the browser to run serverside. So I was going to use Xalan and create a servlet to rip to the browser.

What kind of issues should I be looking at when it runs in a browser, but chokes under the Xalan transform?

Any ideas...

Thank You,
Scott



<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<!-- Xalan  http://www.w3.org/1999/XSL/Transform -->
<!-- IE     http://www.w3.org/TR/WD-xsl -->
	<xsl:template match="/">
	<html>
		<head>
		<script language="JavaScript">
			document.domain="enklav.com";
			function setup() {
 				var pList = new Array();
				pList=parent.contentform.theform._PopUpNames.value.split(":");
 				var fList = new Array();
				fList=parent.contentform.theform._clientFileListString.value.split(":");
				for(loop=0;loop!=pList.length;loop++){
					var x = 0;
					while(x != parent.contentform.theform.elements.length){
						if(parent.contentform.theform.elements[x].name == pList[loop]){
							for(iloop=0;iloop!=(fList.length-1);iloop++){
								var myOptions= new Option(fList[iloop],fList[iloop],true, true);
								parent.contentform.theform.elements[x].options[iloop+3]=myOptions;
							}
							parent.contentform.theform.elements[x].selectedIndex=0;
						}
					x++;
					}
				}
			}// setup
		function selectPopUpItem(imageName){

			//set the popup to the Imagename
			var popupName = parent.contentform.theform.imageField.value;
			var x = 0;
			//find the popup
			while(x != parent.contentform.theform.elements.length){
				if(parent.contentform.theform.elements[x].name == popupName){
					//set the popup to the name
					var opList = parent.contentform.theform.elements[x].options;
					var oLoop=0;
					parent.contentform.theform.elements[x].selectedIndex=0;
					while(oLoop != opList.length){ // select the named item
						if(opList[oLoop].value==imageName){
							parent.contentform.theform.elements[x].selectedIndex=oLoop;
							popUpToField(parent.contentform.theform.elements[x]);
						}//if
						oLoop++;
					}//while
				}//if
				x++;
			}//while
		}// selectPopUpItem
		
		function popUpACEImages(thePopup,adNumber) {
			if(thePopup.name.substring(0,1)=="#" || thePopup.name.substring(0,1)=="*"){

//if(adNumber.length>10){
parent.contentform.theform.imageField.value = thePopup.name;
						if(thePopup.options[thePopup.selectedIndex].value==""){
							var path = 	"/content/"+adNumber.substring(0,1)+"/"+adNumber.substring(1,4)+"/"+ adNumber.substring(4,10) + "/"+ adNumber+"/"+adNumber+".i.a/Images/";		
							var newWin = window.open('','','width=240, scrollbars=yes');
							var dquote = "\"";
							var squote = "\'";
							var StartTag="&lt; ";StartTag="\u003C";
							var StopTag="&gt; ";StopTag="\u003E";

							newWin.document.writeln("<h3>Click on an image to select it.</h3>");
							newWin.document.writeln("<CENTER>");

							for(var k = 3; k!=thePopup.length; k++){

								newWin.document.writeln("<HR/>");
								newWin.document.writeln(StartTag+"A HREF='' onClick='top.opener.selectPopUpItem(" +dquote+thePopup.options[k].value +dquote+");window.close();return false;'"+StopTag);
								newWin.document.writeln(StartTag+"IMG SRC='"+path+thePopup.options[k].value+"' WIDTH='85'/" +StopTag);


								newWin.document.writeln("<BR/>"+thePopup.options[k].value+StartTag+"/A"+StopTag);

							}
							newWin.document.writeln("<HR/>");

	newWin.document.writeln(StartTag+"A HREF='test' onClick='window.close();return false;'"+ StopTag+ "[Cancel/Close]"+ StartTag+ "/A"+StopTag);

							newWin.document.writeln("</CENTER>");
						}
//					}
					
				}
 		}
				function clearStatus() {
				window.status=' ';
		} //clearStatus
		function charCount(currentCount, maxChars){
				window.status=' Character Count: ' + currentCount + '; Maximum: '+maxChars;
		}
//		function validateForm(){
//				var reply="";
//				if(adform.user.value == ""){
//					reply=reply+"Must enter a user name.  ";
//				}
//				if(adform.adName.value == ""){
//					reply=reply+"Must enter a job name.  ";
//				}
//				if(reply != ""){
//					alert(reply);
//					even.returnValue=false;
//				}
//				else
//				{
//					parent.images.location="/interface/adbuildanim.html";
//				}
//		}
		function popUpToText(thePopup,theText){
				theText.value=thePopup.options[thePopup.selectedIndex].value; //??? name instead or pass name below
 		}
 		function doImageForm(theValue) {
// 				parent.contentform.userImages.username.value=parent.contentform.theform.user.value;
// 				parent.contentform.userImages.clientId.value=parent.contentform.theform.clientID.value;
// 				if(theValue.substring(0,1)=="_"){
// 					theValueUNUSED=theValue.substring(1);
// 				}
 				parent.contentform.theform.imageField.value=theValue;
// 				parent.contentform.userImages.submit();
  				parent.results.location='/interface/ImageOptions2.html';
			}
 		function doTextForm(theValue) {
  				parent.contentform.theform.imageField.value=theValue;
// 				parent.images.location='/interface/idleoptions.html';
 				parent.results.location='/interface/textoptions.html';
 		}
		function doOptions(obj) {
			var x = 0;
			while(x != parent.contentform.theform.elements.length){			
				if(parent.contentform.theform.elements[x].name == "-"+ obj.name.substring(2)){
					if(parent.contentform.theform.elements[x].value == "Text"){
						doTextForm(obj.value);
					} else { // image name
						doImageForm(obj.value);
					}
				}
			x++;
			}
		}
		function popUpToField(thePopup){
			var x = 0;
			while(x != parent.contentform.theform.elements.length){
				if(parent.contentform.theform.elements[x].name ==  thePopup.name.substring(1) ){
					parent.contentform.theform.elements[x].value=thePopup.value;
				}
			x++;
			}
		}
		function handleImagePopUp(thePopup){
			if(thePopup.selectedIndex==1){
				parent.contentform.theform.imageField.value=thePopup.name;
				window.open('/interface/chooseImage.html','imagetest','width=285,scrollbars=yes');
			} else if(thePopup.selectedIndex==2){
				thePopup.selectedIndex=0;
			}else {
				popUpToField(thePopup);
			}
		}//handleImagePopUp
		</script>
		<style media="screen" type="text/css">
				#layer1  { position: absolute; top: 360px; left: 66px; width: 133px; height: 78px; visibility: hidden }
				.formElements   {font-family:arial, helvetica, geneva, swiss, sans-serif; color:black; font-size:9pt; line-height:9pt;}
				.radiotext      {font-family:arial, helvetica, geneva, swiss, sans-serif; color:white; font-size:10pt; line-height:10pt;}
				.label          {font-family:arial, helvetica, geneva, swiss, sans-serif; color:white; font-size:10pt; line-height:10pt;}
				A:link          {color:#99cc33}
				A:visited       {color:blue}
				.largeLabel		{font-family:arial, helvetica, geneva, swiss, sans-serif; color:#99cc33; font-size:18pt; line-height:18pt;}
				.coloredlabel    {font-family:arial, helvetica, geneva, swiss, sans-serif; color:#99cc33; font-size:10pt; line-height:10pt;font-weight:bold}
		</style> <title> AdOut.com - 
				<xsl:value-of select="ad/name" />
			</title> 
		</head>
	<body bgcolor="#145C7E" onload="setup()">
		<form action="http://ACEBuilder.enklav.com/cgi-bin/ACE_cgi5.acgi"; method="post" target="results" name="theform">
			<div class="coloredlabel">
				Job Name: <input type="text" name="adName" class="formElements" size="38" maxlength="22" onblur="clearStatus()"> 
				<xsl:choose>
					<xsl:when test="/ad/content_type[.='~default~']"><xsl:attribute name="value"><xsl:value-of select="ad/job_name/default_contents" /></xsl:attribute>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="value"><xsl:value-of select="ad/job_name/user_contents" /></xsl:attribute>
					</xsl:otherwise>
				</xsl:choose>
				</input> 
			</div>
			<hr />
			<div class="largeLabel">
				<b> Content Form 
<!--img src="/interface/save.gif" width="93" height="23" border="0" align="middle" onClick="parent.images.location='/interface/adbuildanim2.html';parent.contentform.theform.Save.click()"/ -->
				</b> 
			</div>
			<table border="0" cellspacing="0" cellpadding="0" width="260">
				<tr valign="middle" height="9">
					<td align="right" valign="middle" colspan="2" height="9">
						<hr />
					</td>
				</tr>
<!-- begin content body part =============================================== -->
				<xsl:for-each select="ad/ad_content">
					<xsl:if test="label[.!='']">
						<tr valign="middle" height="14">
							<xsl:choose>
								<xsl:when test="text_options[.='off']">
									<td align="left" valign="middle" class="label" height="14">
										<b> 
											<xsl:value-of select='label' />
											: </b> 
									</td>
								</xsl:when>
								<xsl:otherwise>
									<xsl:choose>
										<xsl:when test="item_type[.='user_art']">
											<td align="left" valign="middle" class="label" height="14">
												<b> <a href="" onclick="doImageForm(this.value);return false;"> 
														<xsl:attribute name="name">x_<xsl:value-of select="item_name" /></xsl:attribute>
														<xsl:attribute name="value">_<xsl:value-of select="item_name" /></xsl:attribute>
														<xsl:value-of select='label' />:
													</a>
												</b> 
<!--
											<img src="/interface/options.gif" width="66" height="23" border="0" align="middle" onClick="doImageForm(this.value)">
											<xsl:attribute name="name">x_<xsl:value-of select="item_name"/></xsl:attribute>
											<xsl:attribute name="value">_<xsl:value-of select="item_name"/></xsl:attribute>
										</img>
-->
											</td>
										</xsl:when>
										<xsl:otherwise>

											<td align="left" valign="middle" class="label" height="14">
												<b> <a href="" onclick="doOptions(this);return false;"> 
														<xsl:attribute name="name">x_<xsl:value-of select="item_name" /></xsl:attribute>
														<xsl:attribute name="value">_<xsl:value-of select="item_name" /></xsl:attribute>
														<xsl:value-of select='label' />:
													</a>
												</b> 
											</td>
											<td align="right">
<!--
										<img src="/interface/options.gif" width="66" height="23" border="0" align="middle"	onClick="doOptions(this)" title="Click for advanced field options. Blue shading indicates options have been set for this field">
											<xsl:attribute name="name">x_<xsl:value-of select="item_name"/></xsl:attribute>
											<xsl:attribute name="value">_<xsl:value-of select="item_name"/></xsl:attribute>
										</img>
										<br/>
-->
												<select class="formElements" onchange="handleImagePopUp(this)">
													<xsl:attribute name="name">-<xsl:value-of select="item_name" /></xsl:attribute>
													<option value="Text">
														Text
													</option>
													<option value="">
														Show Previews...
													</option>
													<option value="">
														----------------
													</option>
												</select> 
											</td>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</tr>
					</xsl:if>
					<xsl:choose>
					<xsl:when test="item_type[.='hidden']">
						<input type="hidden">
							<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
							<xsl:choose>
								<xsl:when test="/ad/content_type[.='~default~']">
									<xsl:attribute name="value"><xsl:value-of select="default_contents"/></xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="value"><xsl:value-of select="user_contents"/></xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>	
						</input>
					</xsl:when>
					<xsl:otherwise>
					<tr valign="middle">
						<td align="right" colspan="2" valign="middle" height="25">
							<div align="left" class="formElements">
							<xsl:choose>
							<xsl:when test="item_type[.='text']">	
										<input class="formElements" size="52" onBlur="clearStatus()">
											<xsl:attribute name="type"><xsl:value-of select="item_type"/></xsl:attribute>
											<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
											<xsl:attribute name="onFocus">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>
											<xsl:attribute name="onKeyup">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>
											<xsl:attribute name="onChange">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>

								<xsl:choose>
									<xsl:when test="/ad/content_type[.='~default~']">
											<xsl:attribute name="value"><xsl:value-of select="default_contents"/></xsl:attribute>
									</xsl:when>
									<xsl:otherwise>
											<xsl:attribute name="value"><xsl:value-of select="user_contents"/></xsl:attribute>
									</xsl:otherwise>
								</xsl:choose>
						</input>
						</xsl:when>
						<xsl:when test="item_type[.='user_art']">
<!--
							<input class="formElements" size="52" type="text" value="type filename here" onBlur="clearStatus()">
								<xsl:attribute name="name">_Z<xsl:value-of select="item_name"/></xsl:attribute>
								<xsl:attribute name="onFocus">charCount(this.value.length,29)</xsl:attribute>
								<xsl:attribute name="onKeyup">charCount(this.value.length,29)</xsl:attribute>
								<xsl:attribute name="onChange">charCount(this.value.length,29)</xsl:attribute>
							</input>
-->
							<input  type="hidden">
								<xsl:attribute name="name">_<xsl:value-of select="item_name"/></xsl:attribute>
							</input>
							<select class="formElements" onChange="handleImagePopUp(this)">
								<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
									<option>
										Choose Image...
									</option>
									<option>
										Show Previews...
									</option>
									<option>----------------</option>
							</select>
						</xsl:when>
						<xsl:when test="item_type[.='textarea']">
							<TEXTAREA class="formElements" cols="49" rows="6" onblur="clearStatus()">
								<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
								<xsl:attribute name="onFocus">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>
								<xsl:attribute name="onKeyup">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>
								<xsl:attribute name="onChange">charCount(this.value.length,<xsl:value-of select="char_count"/>)</xsl:attribute>
							<xsl:choose>
							<xsl:when test="/ad/content_type[.='~default~']">
								<xsl:value-of select="default_contents"/></xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="user_contents"/></xsl:otherwise>
							</xsl:choose></TEXTAREA>
					</xsl:when>
					<xsl:when test="item_type[.='ACE_art']">
							<select class="formElements">
								<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
			<xsl:attribute name="onChange">popUpACEImages(this,'<xsl:value-of select="/ad/name"/>')</xsl:attribute>
									<option>
										Choose Image...
									</option>
									<option>
										Show Previews...
									</option>
								<option>----------------</option>>
								<xsl:for-each select="option">
									<option>
										<xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
										<xsl:value-of select="name"/>
									</option>
								</xsl:for-each>
							</select>
					</xsl:when>
					<xsl:when test="item_type[.='popup']">
							<select class="formElements">
								<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
								<xsl:if test="line_item[.!='']">
			<xsl:attribute name="onChange">popUpToText(this,adform.clientID)</xsl:attribute>
								</xsl:if>
								<xsl:for-each select="option">
									<option>
										<xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
										<xsl:value-of select="name"/>
									</option>
								</xsl:for-each>
							</select>
					</xsl:when>
					<xsl:otherwise>
						INVALID TYPE ERROR!!!!!! "<xsl:value-of select="item_type"/>"
					</xsl:otherwise>
				</xsl:choose>
							</div>
						</td>
					</tr>
				</xsl:otherwise>
				</xsl:choose>
				</xsl:for-each>
				<tr valign="middle" height="9">
					<td align="right" valign="middle" height="9" colspan="2">
						<div align="left">
							<hr />
							<div class="largeLabel">
								Insertion Information 
							</div>
							<hr />
						</div>
					</td>
				</tr>
<!-- begin Job Setup ========================================================-->
				<xsl:for-each select="ad/job_setup">
				<xsl:choose>
					<xsl:when test="item_type[.='hidden']">
						<input type="hidden">
							<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
							<xsl:choose>
								<xsl:when test="/ad/content_type[.='~default~']">
									<xsl:attribute name="value"><xsl:value-of select="default_contents"/></xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="value"><xsl:value-of select="user_contents"/></xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>	
						</input>
					</xsl:when>
					<xsl:otherwise>
			
				<tr valign="middle" height="14">
					<td align="right" valign="middle" class="coloredlabel" colspan="2" height="14">
<xsl:if test="label[.!='']">
						<div align="left">
						<xsl:value-of select='label'/>:
						</div>
</xsl:if>						
					</td>
				</tr>
				<tr valign="middle">
					<td align="right" valign="middle" colspan="2">
						<div align="left">
						<xsl:choose>
							<xsl:when test="item_type[.='text']">
									<input class="formElements" size="52">
										<xsl:attribute name="type"><xsl:value-of select="item_type"/></xsl:attribute>
											<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
								<xsl:choose>
									<xsl:when test="/ad/content_type[.='~default~']">
										<xsl:attribute name="value"><xsl:value-of select="default_contents"/></xsl:attribute>
									</xsl:when>
									<xsl:otherwise>
										<xsl:attribute name="value"><xsl:value-of select="user_contents"/></xsl:attribute>
									</xsl:otherwise>
								</xsl:choose>
									</input>
							</xsl:when>
							<xsl:when test="item_type[.='textarea']">
										<TEXTAREA class="formElements" rows="3" cols="49"><xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
								<xsl:choose>
									<xsl:when test="/ad/content_type[.='~default~']"><xsl:value-of select="default_contents"/>
									</xsl:when>
									<xsl:otherwise>
											<xsl:value-of select="user_contents"/>
									</xsl:otherwise>
								</xsl:choose>
								</TEXTAREA>
							</xsl:when>
							<xsl:when test="item_type[.='label']">
							<DIV class="coloredlabel">
								<xsl:value-of select="item_name"/>
								<hr/>
							</DIV>
							</xsl:when>
							<xsl:when test="item_type[.='popup']">
								<select class="formElements">
									<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
									<xsl:for-each select="option">
										<option>
											<xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
											 <xsl:if test="@selected[.!='']">
											 	<xsl:attribute name="selected">selected</xsl:attribute>
											 </xsl:if>
											<xsl:value-of select="name"/>
										</option>
									</xsl:for-each>
								</select>
							</xsl:when>
							<xsl:when test="item_type[.='radio']">
								<xsl:for-each select="button"><xsl:value-of select="name"/>
									<input type="radio">
										<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
										<xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
										
									     <xsl:if test="checked">
									      <xsl:attribute name="checked"/>
									     </xsl:if>

										<xsl:value-of select="name"/>
									</input>
								</xsl:for-each>
							</xsl:when>
						<xsl:when test="item_type[.='buildoptions']">
							<hr/>
							<table border="0"><tr valign="top">
								<xsl:for-each select="radio">
									<td>
									<table border="0"><tr><td class="label"><b>
										<xsl:value-of select="label"/>
										</b>
									<xsl:for-each select="button">
										<tr class="label"><td class="radiotext">

										<input type="radio">
											<xsl:attribute name="name"><xsl:value-of select="item_name"/></xsl:attribute>
											<xsl:attribute name="value"><xsl:value-of select="@value"/></xsl:attribute>
											
										     <xsl:if test="checked">
										      <xsl:attribute name="checked"/>
										     </xsl:if>
											<xsl:value-of select="name"/>
										</input>
										</td></tr>
									</xsl:for-each>
								</td></tr></table></td>			
								</xsl:for-each>
								</tr></table>							
							</xsl:when>
							<xsl:otherwise>
								INVALID TYPE ERROR!!!!!!
							</xsl:otherwise>
						</xsl:choose>
						</div>
					</td>
				</tr>
				</xsl:otherwise>
				</xsl:choose>
				</xsl:for-each>
				<tr><td>
					<div id="layer1">
						<input type="submit" name="Build">
							<xsl:attribute name="value"><xsl:value-of select="ad/name"/>.i</xsl:attribute>
						</input>
						<input type="submit" name="Save">
							<xsl:attribute name="value"><xsl:value-of select="ad/name"/>.i</xsl:attribute>
						</input>
						<input type="submit"  name="Load">
							<xsl:attribute name="value"><xsl:value-of select="ad/name"/>.i</xsl:attribute>
						</input>
					</div>
				</td></tr>
			</table>
			<input type="hidden" value="" name="imageField"></input>
		</form>
<!--
		<form method="post" action="http://drawer.adout.com/servlet/UserImages"; name="userImages" target="results">
			<input type="hidden" name="clientId">
			</input>
			<input type="hidden" name="username">
			</input>
		</form>
-->
	</body>
</html>
</xsl:template>
</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]