January 2003
Beginner to intermediate
1200 pages
23h 42m
English
The <xsl:choose> element is much like the Java switch statement, which lets you compare a test value against several possible matches. Suppose, for example, that we add COLOR attributes to each <PLANET> element in ch13_26.xml:
<?xml version="1.0"?> <?xml-stylesheet type="text/xml" href="ch13_02.xsl"?> <PLANETS> <PLANET COLOR="RED"> <NAME>Mercury</NAME> <MASS UNITS="(Earth = 1)">.0553</MASS> <DAY UNITS="days">58.65</DAY> <RADIUS UNITS="miles">1516</RADIUS> <DENSITY UNITS="(Earth = 1)">.983</DENSITY> <DISTANCE UNITS="million miles">43.4</DISTANCE><!--At perihelion--> </PLANET> <PLANET COLOR="WHITE"> <NAME>Venus</NAME> <MASS UNITS="(Earth = 1)">.815</MASS> <DAY UNITS="days">116.75</DAY> <RADIUS UNITS="miles">3716</RADIUS> ... |