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]

Problem in XSL - eval function and javascript


Hi

I am creating an XSL file. I have to include a client
side script, but the problem I am facing is that
whenever I am transforming the XSL and XML ..it gives
me a error saying "Object expected", error returned
from function or method. I am using XML spy 3.0 and
version 3 of msxsl.dll

I am pasting the code below...please let me know where
I am going wrong and what do I have to do to get a
number back??? 

XML:
<!-- edited with XML Spy v3.5 NT
(http://www.xmlspy.com) by  () -->
<?xml-stylesheet type="text/xsl" href="new.xsl"?>
<ScreenPopulate>
	<Nationalitys>
		<Nationality alpha="(A)">
			<Key>{11277AE8-6967-11D5-A190-000347240DC9}</Key>
			<Item>British or Mixed British</Item>
		</Nationality>
		<Nationality alpha="(B)">
			<Key>{11277AEA-6967-11D5-A190-000347240DC9}</Key>
			<Item>English</Item>
		</Nationality>
		<Nationality alpha="(C)">
			<Key>{11277AEB-6967-11D5-A190-000347240DC9}</Key>
			<Item>Irish</Item>
		</Nationality>
		<Nationality alpha="(D)">
			<Key>{11277AEC-6967-11D5-A190-000347240DC9}</Key>
			<Item>Scottish</Item>
		</Nationality>
		<Nationality alpha="(E)">
			<Key>{11277AED-6967-11D5-A190-000347240DC9}</Key>
			<Item>Welsh</Item>
		</Nationality>
		<Nationality alpha="(F)">
			<Key>{11277AEE-6967-11D5-A190-000347240DC9}</Key>
			<Item>Other (specify if you wish)</Item>
		</Nationality>
		<Nationality>
			<Key>{7FB1E1A2-A856-11D5-A1A9-000347240DC9}</Key>
			<Item>No Reply</Item>
		</Nationality>
	</Nationalitys>
	<Backgrounds>
		<Background Group="Asian" alpha="(A)">
			<Key>{11277AEF-6967-11D5-A190-000347240DC9}</Key>
			<Item>Bangladeshi</Item>
		</Background>
		<Background Group="Asian" alpha="(B)">
			<Key>{11277AF0-6967-11D5-A190-000347240DC9}</Key>
			<Item>Indian</Item>
		</Background>
		<Background Group="Asian" alpha="(C)">
			<Key>{11277AF
1-6967-11D5-A190-000347240DC9}</Key>
			<Item>Pakistani</Item>
		</Background>
		<Background Group="Asian" alpha="(D)">
			<Key>{11277AF2-6967-11D5-A190-000347240DC9}</Key>
			<Item>Other (specify if you wish)</Item>
		</Background>
		<Background Group="Black" alpha="(E)">
			<Key>{11277AF3-6967-11D5-A190-000347240DC9}</Key>
			<Item>African</Item>
		</Background>
		<Background Group="Black" alpha="(F)">
			<Key>{11277AF4-6967-11D5-A190-000347240DC9}</Key>
			<Item>Caribbean</Item>
		</Background>
		<Background Group="Black" alpha="(G)">
			<Key>{11277AF5-6967-11D5-A190-000347240DC9}</Key>
			<Item>Other (specify if you wish)</Item>
		</Background>
		<Background Group="Chinese" alpha="(H)">
			<Key>{11277AF6-6967-11D5-A190-000347240DC9}</Key>
			<Item>Chinese (specify if you wish</Item>
		</Background>
		<Background Group="Mixed Ethnic Background"
alpha="(I)">
			<Key>{11277AF7-6967-11D5-A190-000347240DC9}</Key>
			<Item>Asian and White</Item>
		</Background>
		<Background Group="Mixed Ethnic Background"
alpha="(J)">
			<Key>{11277AF8-6967-11D5-A190-000347240DC9}</Key>
			<Item>Black African and White</Item>
		</Background>
		<Background Group="Mixed Ethnic Background"
alpha="(K)">
			<Key>{11277AF9-6967-11D5-A1
90-000347240DC9}</Key>
			<Item>Black Caribbean and White</Item>
		</Background>
		<Background Group="Mixed Ethnic Background"
alpha="(L)">
			<Key>{11277AFA-6967-11D5-A190-000347240DC9}</Key>
			<Item>Other (specify if you wish)</Item>
		</Background>
		<Background Group="White" alpha="(M)">
			<Key>{11277AFB-6967-11D5-A190-000347240DC9}</Key>
			<Item>White (specify if you wish)</Item>
		</Background>
		<Background Group="Other Ethnic Background"
alpha="(N)">
			<Key>{11277AFC-6967-11D5-A190-000347240DC9}</Key>
			<Item>Other (specify if you wish)</Item>
		</Background>
		<Background Group="">
			<Key>{7FB1E1A1-A856-11D5-A1A9-000347240DC9}</Key>
			<Item>No Reply</Item>
		</Background>
	</Backgrounds>
</ScreenPopulate>

XSL:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match ="/">
<html>
<head>
<script language="javascript"><xsl:comment><![CDATA[
var strVal
strVal="aa"
function abd(objVal)
	if (strVal== objVal)
	{
		return "yes"
	}
	else
	{
		strVal= objVal
		return  "no"
	}
}
//]]></xsl:comment></script>
<title>Ethnic Origin</title>
</head>
<body>
<table class="TableFullWidth" width="100%">
	<tr class="HeadRow" bgcolor="silver">
		<td align="center" colspan="2"><b>Ethnic Monitoring
Questionnaire</b></td>
	</tr>
	<tr height="60">
		<td colspan="2">Which groups do you most identify
with? Please tick only <b><u>ONE</u></b> box in
<b>column A <u>and ONE</u></b> box in <b>column B</b>
(The options are listed alphabetically). If you work
in Northern Ireland, please answer the additional
question in column A.</td>
	</tr>
	<tr>
		<td width="40%"  valign="top">
			<table width="100%" cellpading="0" cellspacing="0">
				<tr>
					<td>
						<b>Column A</b>
					</td>
				</tr>
				<tr>
					<td>
						<xsl:for-each
select="/ScreenPopulate/Nationalitys/Nationality">
							<xsl:value-of select="@alpha"/><input
type="radio" name="RadioNation"
value="{./Key}"></input><xsl:value-of
select="./Item"/> <br/>
						</xsl:for-each>
						<br/>
						&#160;&#160;&#160;&#160;&#160;&#160;<input
type="text" name="txtNation"/>
					</td>
				</tr>
				<tr height="60" valign="bottom" >
					<td>
						PLEASE ALSO ANSWER THE QUESTION BELOW <b>ONLY IF
YOU WORK IN NORTHERN IRELAND:</b>
					</td>
				</tr>
				<tr>
					<td>
						Are you a member of the Irish Traveller
Community?
					</td>
				</tr>
				<tr>
					<td>
						(T) <input type="radio" name="radioNorthern"
value="Y">Yes</input>
						<br/>
						( )  <input type="radio" name="radioNorthern"
value="N">No</input>
					</td>
				</tr>
			</table>
		</td>
		<td width="60%"  valign="top">
			<table width="100%" cellpading="0" cellspacing="0">
				<tr>
					<td>
						<b>Column B</b>
					</td>
				</tr>
				<xsl:for-each
select="/ScreenPopulate/Backgrounds/Background">
					<xsl:if expr="abd('Asian')='false'">
						<tr height="50">
							<td>
								<b><xsl:value-of select="@Group"/></b>
							</td>
						
						</tr>
					</xsl:if>
					<tr>
						<td>
							<xsl:value-of select="@alpha"/><input type
="radio" name="radioBackground"
value="{./Key}"><xsl:value-of
select="./Item"/></input><br/>
						</td>
					</tr>

				</xsl:for-each>
				
			</table>
		</td>
	</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>



____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie

 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]