sullivans20
Technical User
I am having trouble trying to figure out how exactly I can grab different "cubes" with different ids on the fly so to speak. First here is my cube.xml file:
Now the above xml file would go all the way to 68 but I cut the rest out to save space. Now here is the xsl stylesheet i'm using to style the xml document (cube.xsl):
Here is the page i'm calling the xml file from (you can ignore the second xml file troubleLog.xml for now in the second frame):
As you can see right now I have cube.xsl hard coded to only retrieve records matching cube="001". This is no good because I might want to retreive any other record 1-68 in cube.xml.
Let me try and give you a bigger picture to try and help you better understand what i'm trying to do. On my main page I have a huge graphic of a office floor. When the user clicks on a cubicle it will bring up information about the employee who sits there. It will also have a trouble shooting log for each person (thats what troubleLog.xml is for). All this will be determined though by what cube a user clicks on.
If a user clicks cube 2 they should only get the information returned to them matching cube id="002". My problem right now is figuring out how exactly I can do this. I'm not sure exactly how I can accomplish this. I know I could do it if I made a new xml and xsl file for each cube but this seems like a really dirty hack (not to mention super tedious). If anyone has an idea i'd love to hear it.
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl" href="cube.xsl"?>
<office>
<cube id="001">
<empName>Removed</empName>
<phoneNum>xxx</phoneNum>
<machineName>Removed</machineName>
<ip>Removed</ip>
</cube>
<cube id="002">
<empName>Removed</empName>
<phoneNum>xxx</phoneNum>
<machineName>Removed</machineName>
<ip>Removed</ip>
</cube>
</office>
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//cube[@id='001']">
<p align="center">
<b>
<u>
Detailed Information For <xsl:value-of select="empName"/>
</u>
</b>
</p>
<br />
<table border="1">
<tr bgcolor="#6183A6">
<th align="left">Employee Name</th>
<th align="left">Phone Number</th>
<th align="left">Machine Name</th>
<th align="left">IP Address</th>
</tr>
<tr>
<td><xsl:value-of select="empName"/></td>
<td><xsl:value-of select="phoneNum"/></td>
<td><xsl:value-of select="machineName"/></td>
<td><xsl:value-of select="ip"/></td>
</tr>
</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html>
<head>
<title>Floor Plan - Cube One</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
</head>
<frameset border="1" cols="375,*" frameBorder="0" frameSpacing="4">
<noframes>
<body>
</body>
</noframes>
<frame name="right" src="cube.xml">
<frame name="left" src="troubleLog.xml">
</frameset>
</html>
Let me try and give you a bigger picture to try and help you better understand what i'm trying to do. On my main page I have a huge graphic of a office floor. When the user clicks on a cubicle it will bring up information about the employee who sits there. It will also have a trouble shooting log for each person (thats what troubleLog.xml is for). All this will be determined though by what cube a user clicks on.
If a user clicks cube 2 they should only get the information returned to them matching cube id="002". My problem right now is figuring out how exactly I can do this. I'm not sure exactly how I can accomplish this. I know I could do it if I made a new xml and xsl file for each cube but this seems like a really dirty hack (not to mention super tedious). If anyone has an idea i'd love to hear it.