Just nu i M3-nätverket
Jump to content

nästlad for-each sats i XSL


Marcus Svensson

Recommended Posts

Marcus Svensson

Hej

 

Jag tänkte bara kolla om någon vet om man kan göra nästlade for-each satser i XSL, och skall man göra på något speciellet sätt i sådana fall?

 

Jag har försökt göra det men får det ej att fungera som det skall, den nästlade for-each satsen skriver endast ut en utav värdena, inte alla som det borde.

 

XML dokument:

<?xml version="1.0"?>
<?xml:stylesheet type="text/xsl" href="updates.xsl"?>
<updates>
	<update>
		<version>Update 6.60</version>
		<date>2002-10-01</date>
[b]
		<changes>
			<change>Trade prices now differ +-10% from the black market prices</change>
			<change>Trade now requires 3 turns</change>
			<change>You can from now on only recieve 2 trade deals ever day, and send only 2 trade deals every day</change>
			<change>Black Market is now completly static and goods cannot be sold on the Public Market at a higher price than the Black Market prices</change>
			<change>Tech price for nations have been lowered to $6000</change>
			<change>Prices has been chagned a bit overall</change>

		</changes>
[/b]
	</update>
	<update>
		<version>Update 6.50</version>
		<date>2002-09-22</date>
		<changes>
			<change>This page is released and all changes from now on will be listed at this page</change>
		</changes>
	</update>
	<update>
		<version>Update 6.00</version>
		<date>2002-xx-xx</date>
		<changes>
			<change>The new wow beta is released to a small group of people.</change>
		</changes>
	</update>
</updates>
XSL:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="updates">
	<html>
	<head>
		<title>World of War Online Game</title>
		<link rel="STYLESHEET" type="text/css" href="css/navigation.css" />
		<link rel="STYLESHEET" type="text/css" href="css/main.css" />
		<link rel="STYLESHEET" type="text/css" href="css/forms.css" />
		<link rel="STYLESHEET" type="text/css" href="css/scores.css" />
		<link rel="STYLESHEET" type="text/css" href="css/events.css" />
	</head>
	<script language="JavaScript" src="js/main.js"></script>
	<script language="JavaScript">
		updateFramsetTitle('World of War Online Game - Scores');
	</script>
	<body>
		<table width="100%">
		<tr>
			<td colspan="2" align="center">
				<img src="images/logo2.jpg" />
			</td>
		</tr>
		<tr>
			<td align="center">		
				<h1>Game Updates</h1>
				<table border="0" cellspacing="0">
				<xsl:for-each select="update">
					<tr>
						<th width="100" align="left"><xsl:value-of select="version"/></th>
						<th align="left"><xsl:value-of select="date"/></th>
					</tr>
					<tr>
						<td colspan="2" align="left">
							<ul type="disc">
	[b]						<xsl:for-each select="changes">
								<li><xsl:value-of select="change"/></li>
							</xsl:for-each>
	[/b]						</ul>
						</td>
					</tr>
					<tr>
						<td colspan="2"><hr/></td>
					</tr>
				</xsl:for-each>
				</table>
			</td>
		</tr>
		</table>
	</body>
	</html>
</xsl:template>
</xsl:stylesheet>

sidan kan även hittas här:

svenneman.mine.nu/wow/war1/updates.xml

 

som ni kanske kan se från koden så är det <change></change> som är den taggen som skall skrivas ut i en for-each loop i en annan for-each loop. Men bara den första <change></change> taggen skrivs ut, inte all

 

Jättesjysst om nån kunde hjälpa mig,

 

MVH

</\>

<||> Marcus Svensson

<||> http://www.world-of-war.com

<||> matrx@home.se

<\/>

 

[inlägget ändrat 2002-09-22 11:50:36 av Marcus Svensson]

[inlägget ändrat 2002-09-22 11:51:41 av Marcus Svensson]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...