MRMAN
05-30-2006, 03:11 PM
Hello.
I am trying to make a site that uses a xml feed. But instead of having one xml, xsl and css for every user i want to user JavaScript to pull the username from the url query string and user the style.css in the correct folder.
this is what i have and this works.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="html" />
<xsl:template match="/">
<html lang="en" xml:lang="en">
<head>
<script language="javascript" type="text/javascript">
test = location.search;
test2 = test.substring(1);
var temp = new Array();
temp = test2.split("&");
var i = 0;
for(x in temp)
{
fonzie = temp[x]
start = new Array()
start = fonzie.split("=")
if(start[0] == 'affid')
{
alert('<link rel="stylesheet" type="text/css" href="'+start[1]+'/style.css" />')
document.write('<link rel="stylesheet" type="text/css" href="'+start[1]+'/style.css" />')
}
}
</script></head><body>
OK like i said that bit work. the next thing i want to do is to create a variable, again from the query string, that can be used in the rest of the xml. This is what i have
<script language="javascript" type="text/javascript">
test = location.search;
test2 = test.substring(1);
var temp = new Array();
temp = test2.split("&");
var i = 0;
for(x in temp)
{
fonzie = temp[x]
start = new Array()
start = fonzie.split("=")
if(start[0] == 'affid')
{
document.write('<xsl:variable name="affid">1234</xsl:variable>')
}
if(start[0] == 'fimsid')
{
alert('<xsl:variable name="fimsid">431</xsl:variable>')
document.write('<xsl:variable name="fimsid">431</xsl:variable>')
}
}
</script>
and this is the code i am using so put the variable onto the screen
<tr onmouseover="this.className='selectionrowover'" onmouseout="this.className='selectionrow'" class="selectionrow" onclick="document.location='http://www.google.com/betslip/betsliplanding.asp?selid={@id}&price={@price}&fimsId={$fimsid}&affid={$affid}'">
Please note that this is almost exactly the same code as above.
But if i have the second and third parts in the xsl file i get the error saying "Error during XSLT transformation: (null)"
This i assume is because the variables have not been defined.
Anyone got and clue what i need to do.
Cheers
MRMAN
I am trying to make a site that uses a xml feed. But instead of having one xml, xsl and css for every user i want to user JavaScript to pull the username from the url query string and user the style.css in the correct folder.
this is what i have and this works.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output encoding="utf-8" method="html" />
<xsl:template match="/">
<html lang="en" xml:lang="en">
<head>
<script language="javascript" type="text/javascript">
test = location.search;
test2 = test.substring(1);
var temp = new Array();
temp = test2.split("&");
var i = 0;
for(x in temp)
{
fonzie = temp[x]
start = new Array()
start = fonzie.split("=")
if(start[0] == 'affid')
{
alert('<link rel="stylesheet" type="text/css" href="'+start[1]+'/style.css" />')
document.write('<link rel="stylesheet" type="text/css" href="'+start[1]+'/style.css" />')
}
}
</script></head><body>
OK like i said that bit work. the next thing i want to do is to create a variable, again from the query string, that can be used in the rest of the xml. This is what i have
<script language="javascript" type="text/javascript">
test = location.search;
test2 = test.substring(1);
var temp = new Array();
temp = test2.split("&");
var i = 0;
for(x in temp)
{
fonzie = temp[x]
start = new Array()
start = fonzie.split("=")
if(start[0] == 'affid')
{
document.write('<xsl:variable name="affid">1234</xsl:variable>')
}
if(start[0] == 'fimsid')
{
alert('<xsl:variable name="fimsid">431</xsl:variable>')
document.write('<xsl:variable name="fimsid">431</xsl:variable>')
}
}
</script>
and this is the code i am using so put the variable onto the screen
<tr onmouseover="this.className='selectionrowover'" onmouseout="this.className='selectionrow'" class="selectionrow" onclick="document.location='http://www.google.com/betslip/betsliplanding.asp?selid={@id}&price={@price}&fimsId={$fimsid}&affid={$affid}'">
Please note that this is almost exactly the same code as above.
But if i have the second and third parts in the xsl file i get the error saying "Error during XSLT transformation: (null)"
This i assume is because the variables have not been defined.
Anyone got and clue what i need to do.
Cheers
MRMAN