Re: [xsl] Pass variables through URL

Subject: Re: [xsl] Pass variables through URL
From: Jen Jiang <zhenjiang14221@xxxxxxxxx>
Date: Mon, 18 Oct 2004 18:33:29 -0700 (PDT)
Here's the xslt file that has the url:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<xsl:import href="cascademenu_member.xsl"/>
	<xsl:import href="footer.xsl"/>
	<xsl:import href="menubarh.xsl"/>
	<xsl:import href="menubarh_member.xsl"/>
	<xsl:import href="header.xsl"/>
	<xsl:output method="text/html"
encoding="iso-8859-1"/>
	<xsl:template match="/">
		<html>
			<head>
				<title>View all the upcoming events</title>
				<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1"/>
				<link rel="stylesheet" href="../style/style.css"
type="text/css"/>
				<link rel="stylesheet"
href="../style/cascademenu.css" type="text/css"/>
				<!--xsl:import href="cascademenu_member.xsl"/-->
				<xsl:call-template name="cascademenu_member" />
			</head>
			<body bgcolor="#8080C0" marginwidth="0"
marginheight="0" style="margin: 0"
onLoad="writeMenus()" onResize="if (isNS4)
nsResizeHandler()">
				<!--xsl:import href="header.xsl" /-->
				<xsl:call-template name="header" />
				<!--Start of repeating part-->
				<table width="100%" border="0" align="center"
cellpadding="10">
					<!--xsl:import href="menubarh.xsl" /-->
					<xsl:call-template name="menubarh_member" />
					<tr bgcolor="#6699FF">
						<td width="18%" valign="top" bgcolor="#CCCCCC">
							<font color="#FFFF33" face="Verdana, Arial,
Helvetica, sans-serif" size="2">
								<div align="right">							</div>
							</font>
						</td>
						<td bgcolor="#FFFFFF" valign="top" height="400">
							<!--End of repeating part-->
							<div align="center">
								<xsl:for-each select="ROOT">
									<xsl:variable name="age1">
										<xsl:value-of select="AGE1"/>
									</xsl:variable>
									THIS IS AGE1:<xsl:value-of select="$age1"/>
									<xsl:variable name="age2">
										<xsl:value-of select="AGE2"/>
									</xsl:variable>
									<xsl:variable name="age3">
										<xsl:value-of select="AGE3"/>
									</xsl:variable>
									<xsl:variable name="age4">
										<xsl:value-of select="AGE4"/>
									</xsl:variable>
									<xsl:variable name="age5">
										<xsl:value-of select="AGE5"/>
									</xsl:variable>
									<xsl:variable name="age6">
										<xsl:value-of select="AGE6"/>
									</xsl:variable>
									<xsl:variable name="age7">
										<xsl:value-of select="AGE7"/>
									</xsl:variable>
									<xsl:variable name="age8">
										<xsl:value-of select="AGE8"/>
									</xsl:variable>
<xsl:element name='img'>
	<xsl:attribute name='src'>
		<xsl:text>./php/chart_age.php?age1=</xsl:text>
		<xsl:value-of select='$age1'/>
		<xsl:text>&amp;age2=</xsl:text>
		<xsl:value-of select='$age2'/>
		<xsl:text>&amp;age3=</xsl:text>
		<xsl:value-of select='$age3'/>
		<xsl:text>&amp;age4=</xsl:text>
		<xsl:value-of select='$age4'/>
		<xsl:text>&amp;age5=</xsl:text>
		<xsl:value-of select='$age5'/>
		<xsl:text>&amp;age6=</xsl:text>
		<xsl:value-of select='$age6'/>
		<xsl:text>&amp;age7=</xsl:text>
		<xsl:value-of select='$age7'/>
		<xsl:text>&amp;age8=</xsl:text>
		<xsl:value-of select='$age8'/>
	</xsl:attribute>
</xsl:element>
								
								</xsl:for-each>
							</div>
						</td>
					</tr>
				</table>				<xsl:call-template name="footer" />
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>

And the XML file that has the values of age1-age8.

<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
	<AGE1>30</AGE1>
	<AGE2>10</AGE2>
	<AGE3>30</AGE3>
	<AGE4>10</AGE4>
	<AGE5>20</AGE5>
	<AGE6>0</AGE6>
	<AGE7>0</AGE7>
	<AGE8>0</AGE8>
</ROOT>


Thanks...



--- "Werner, Wolfgang" <mail@xxxxxxxxxxxxxxxxxxx>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I assume that AGE1 is the name of the element whose
> content you want to
> set the variable to, and not the value the variable
> should have.
> 
> Do you set the variable in the same template you
> construct the URL?
> 
> I think it would help if you posted your stylesheet
> and an example input
> file to reproduce the error
> 
> Wolfgang
> 
> Jen Jiang wrote:
> 
> | This is how I set the variables:
> | <xsl:variable name="age1">
> | <xsl:value-of select="AGE1"/>
> | </xsl:variable>
> | ...
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Cygwin)
> Comment: Using GnuPG with Thunderbird -
> http://enigmail.mozdev.org
> 
>
iD8DBQFBc3GuqjaicDyx8o8RAiNXAJ9CZKJePFvL+YRmYY48teLR0IyePwCgiHWA
> 7bjP6rPsVnM0OIJwbdo7Io4=
> =mM+5
> -----END PGP SIGNATURE-----
> 
> 



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

Current Thread