Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 25th, 2015, 09:10 AM
Registered User
 
Join Date: Mar 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Not valid. Error: javax.xml.transform.TransformerException: xsl:eval is not allowed i

The code works fine in IE8 and below.
It doesnt work from IE9 onwards.

is there an issue with using <xsl:eval>javascript:option1</xsl:eval>
where the option1 is defined later in the script.

the namespace being used is
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" version="1.0">
 
Old March 25th, 2015, 09:44 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

I suspect it was part of the WD-XSL namespace mentioned here:

https://msdn.microsoft.com/en-gb/lib...(v=vs.85).aspx

Try describing what the code above it trying to do, and we might be able to help you convert it to something more appropriate.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old March 26th, 2015, 02:15 AM
Registered User
 
Join Date: Mar 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
<form name="form" method="post">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="white">
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="318">
				<tr>
					<td colspan="6" bgcolor="darkseagreen"><b>Region</b></td>
				</tr>
				<xsl:apply-templates select=".//BIG"/>
				<tr>
					<td width="7"></td>
					<TD>Region*:</TD>
					<td width="93"></td>
					<td>
						<SELECT NAME="Region" OnChange="onRegionChange(this)" style="color: black; font-size: 10px;font-weight: normal;font-family: Verdana, Arial, Helvetica, sans-serif">
							<OPTION><xsl:eval>javascript:option1</xsl:eval></OPTION><OPTION><xsl:eval>javascript:option2</xsl:eval></OPTION><OPTION><xsl:eval>javascript:option3</xsl:eval></OPTION><OPTION><xsl:eval>javascript:option4</xsl:eval></OPTION>
						</SELECT>
					</td>
				</tr>
			</table>
		<br/>
		</td>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="320">
				<tr>
					<td align="right"><h4 style="color: Red;">Test Detail Invoice (810)</h4></td>
				</tr>
				<tr>
					<td align="right" colspan="2">* <i>Indicates a required field</i></td>
				</tr>
			</table>
		</td>
	</tr>
    <tr>
		<td valign="top">
			<table cellpadding="0" cellspacing="0" border="0" width="320">
				<tr><td colspan="6" bgcolor="darkseagreen"><b>Supplier Information</b></td></tr>
				<tr>
					<td width="7"></td>
					<td>Name*:</td>
					<td></td>
					<td><xsl:apply-templates select="//N1_810_GROUP[0]/N1_N1/N1_N1_01_93"/></td>
				</tr>
				<tr>
					<td width="7"></td>
					<td>DUNS Num*:</td>
					<td></td>
					<td><xsl:apply-templates select="//N1_810_GROUP[0]/N1_N1/N1_N1_01_67"/></td>
				</tr>
				<INPUT TYPE='hidden' NAME='REF_01_127'/>
				  <TR>
					<td width="7"></td>
					<td>Tax Registration Num:</td>
					<td width="3"></td>
					<td><input type="text" size="17" maxlength="30" name="TAXNUMBER" onchange="onChangeTAXNUMBER(this)"/></td>
				</TR>
			</table>
		<br/>
		</td>
		<td valign="top">
			<table cellpadding="0" cellspacing="0" border="0" width="320">
				<tr><td colspan="4" bgcolor="darkseagreen"><b>Shipping/Billing Information</b></td></tr>
				<tr>
					<td width="10"></td>
					<td>Distribution Center:</td>
					<td width="15"></td>
					<td>
						<xsl:apply-templates select="//N1_810_GROUP[1]/N1_N1/N1_N1_01_67"/>
					</td>
				</tr>
				<tr>
					<td width="7"></td>
					<td>Customer/Store Num:</td>
					<td width="27"></td>
					<td><input type="text" size="17" maxlength="13" name="N1_N1_01_67_INPUT" onblur="onChangeDUNS(this, 27, 13, false)"/></td>
				</tr>
				<tr>
					<td width="7"></td>
					<td>Bill To*:</td>
					<td></td>
					<td>
						<xsl:apply-templates select="//N1_810_GROUP[2]/N1_N1/N1_N1_01_67"/>
					</td>
				</tr>
			</table>
		<br/>
		</td>
	</tr>

This is the part that's throwing the error that xsl:eval is not allowed in this position in the stylesheet!.

Regards,
Ramya
 
Old March 27th, 2015, 04:44 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Yeah, that doesn't really help much.

What is "option1" and "option2". What are you trying to output, and where in your input does this information come from?
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?
 
Old March 30th, 2015, 02:41 AM
Registered User
 
Join Date: Mar 2015
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
<xsl:script language='JavaScript'><![CDATA[
	
	var sSobeysRegion = "Sobeys West";
	var sReceiverID = "SOBEYSCANADA:ZZ";
	var ATLANTIC = "Sobeys Atlantic";
	var WEST = "Sobeys West";
	var QUEBEC = "Sobeys Quebec";
	var ONTARIO = "Sobeys Ontario";
	var option1 = ATLANTIC ;
	var option2 = WEST ;
	var option3 = QUEBEC ;
	var option4 = ONTARIO ;

	function getRegion(sVar)
	{
		if (sVar == sSobeysRegion) {
			return true;
		}
		else {
			return false;
		}
	}

	function setReceiverID(sTmp)
	{
		if (sTmp == "Sobeys Atlantic") {
			sReceiverID = "SOBNBTATL:ZZ";
			option1 = ATLANTIC;
			option2 = WEST;
			option3 = ONTARIO;
			option4 = QUEBEC;
		}
		else if (sTmp == "Sobeys West") {
			sReceiverID = "SOBNBTWST:ZZ";
			option2 = ATLANTIC;
			option1 = WEST;
			option3 = QUEBEC;
			option4 = ONTARIO;
		}
		else if (sTmp == "Sobeys Quebec") {
			sReceiverID = "SOBNBTQUE:ZZ";
			option2 = ATLANTIC;
			option3 = WEST;
			option4 = ONTARIO;
			option1 = QUEBEC;
		}
		else if (sTmp == "Sobeys Ontario") {
			sReceiverID = "SOBNBTONT:ZZ";
			option2 = ATLANTIC;
			option3 = WEST;
			option1 = ONTARIO;
			option4 = QUEBEC;
		}
	}
This is the place where the option1 and option 2 has been definied.
 
Old March 30th, 2015, 06:27 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

It looks like you would be better to actually move this code into the Javascript of the resulting HTML document, rather than try to do it in XSLT. I'm sure it can be done, but perhaps not easily.
__________________
/- Sam Judson : Wrox Technical Editor -/

Think before you post: What have you tried?





Similar Threads
Thread Thread Starter Forum Replies Last Post
<?javax.xml.transform.disable-output-escaping ?> robbert XSLT 5 January 5th, 2011 07:28 PM
Split xml file with result document and javax.xml.transform.Transformer. nisargmca XSLT 3 January 12th, 2010 06:26 AM
javax.xml.transform.TransformerConfigurationExcept ashok.andena XSLT 9 March 7th, 2008 08:14 AM
Exception in thread "main" javax.xml.transform.Tra XSLTUser XSLT 1 December 29th, 2007 04:59 AM
How do you transform a XML SOAP Response using XSL wsessoms VB How-To 0 December 20th, 2006 08:21 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.