[Home] [By Thread] [By Date] [Recent Entries]
Hello All,
I am missing something when it comes to row-wise insertions inside table. Attached are the sample XSL and sample XML. Inside XSL, I have a transformation structure like: <tr align="center"> <xsl:for-each select="descendant-or-self::Feature[1]/Attribute"> <td> <xsl:value-of select="@value"/> </td> </xsl:for-each> </tr> but I want to make it dynamic, hence, I can get rid of explicit numbering inside Feature[]. I did poke around using mod and position but no success yet. Any tips are greatly appreciated. Thanks, VJ --------- XML file --------- <XLS xmlns:gml="http://www.opengis.net/gml" version="1.0"> <ResponseHeader/> <Response numberOfResponses="1">
<GeocodeResponse>
<GeocodeResponseList numberOfGeocodedAddresses="1">
<GeocodedAddress>
<Point>
<gml:pos>-77.069363 38.894926</gml:pos>
</Point>
<Address countryCode="US">
<StreetAddress>
<Building number="1601"/>
<Street directionalPrefix="N" officialName="KENT" typeSuffix="ST"/>
</StreetAddress>
<Place type="CountrySubdivision">VA</Place>
<Place type="Municipality">ARLINGTON</Place>
<PostalCode>22209</PostalCode>
</Address>
<GeocodeMatchCode accuracy="1.0" matchType="House"/>
</GeocodedAddress>
</GeocodeResponseList>
</GeocodeResponse><HazardReport> <Category name="Tornadoes"> <Dataset title="Detected Tornado Reports"> <Description>Tornado cyclones sensed, derived from Doppler radar signatures.</Description> <Features> <Feature relationship="Intersects"> <Attribute name="Date" value="2006-04-17/22:56:22"/> <Attribute name="Vortex Signature" value="ETVS">Tor vor sig detected</Attribute> <Attribute name="Storm Latitude" value="33.435"/> <Attribute name="Storm Longitude" value="-77.79"/> </Feature> <Feature relationship="Intersects"> <Attribute name="Date" value="2005-04-17/22:56:22"/> <Attribute name="Vortex Signature" value="EETVS">Tor vor sig detected</Attribute> <Attribute name="Storm Latitude" value="33.535"/> <Attribute name="Storm Longitude" value="-77.79"/> </Feature> <Feature relationship="Intersects"> <Attribute name="Date" value="2004-04-17/22:56:22"/> <Attribute name="Vortex Signature" value="EEETVS">Tor vor sig detected</Attribute> <Attribute name="Storm Latitude" value="33.635"/> <Attribute name="Storm Longitude" value="-77.79"/> </Feature> </Features> </Dataset>
<Features> <Feature relationship="440 meters distant"> <Attribute name="Date" value="2006-01-13/19:38:00"/> <Attribute name="Description" value="SHERIFF SPOTTED A TORNADO MOVING NORTHEAST.">Description of tornadic event.</Attribute> <Attribute name="Fujita Scale" value="F3">The Fujita Scale, if available. -1000 indicates no scale determined.</Attribute> <Attribute name="Tornado Latitude" value="31.52"/> <Attribute name="Tornado Longitude" value="-84.92"/> </Feature> <Feature relationship="880 meters distant"> <Attribute name="Date" value="2006-01-13/20:38:00"/> <Attribute name="Description" value="Jesse saw it! Look Out!">Description of tornadic event.</Attribute> <Attribute name="Fujita Scale" value="-1000">The Fujita Scale, if available. -1000 indicates no scale determined.</Attribute> <Attribute name="Tornado Latitude" value="31.52"/> <Attribute name="Tornado Longitude" value="-84.92"/> </Feature> <Feature relationship="1660 meters distant"> <Attribute name="Date" value="2006-01-13/21:38:00"/> <Attribute name="Description" value="Captured video from Vijay">Description of tornadic event.</Attribute> <Attribute name="Fujita Scale" value="F5">The Fujita Scale, if available. -1000 indicates no scale determined.</Attribute> <Attribute name="Tornado Latitude" value="31.52"/> <Attribute name="Tornado Longitude" value="-84.92"/> </Feature> </Features> </Dataset> <Dataset title="Tornado Warnings"> <Description>The National Weather Service has issued a tornado warning for the area.</Description> <Features> <Feature relationship="Intersects"> <Attribute name="Issue Date" value="2006-05-05/13:29:00"/> <Attribute name="Expiration Date" value="2006-05-05/14:15:00"/> </Feature> <Feature relationship="Intersects"> <Attribute name="Issue Date" value="2006-05-05/14:29:00"/> <Attribute name="Expiration Date" value="2006-05-06/05:15:00"/> </Feature> <Feature relationship="Intersects"> <Attribute name="Issue Date" value="2006-05-08/03:29:00"/> <Attribute name="Expiration Date" value="2006-05-08/04:15:00"/> </Feature> <Feature relationship="Intersects"> <Attribute name="Issue Date" value="2006-05-05/16:29:00"/> <Attribute name="Expiration Date" value="2006-05-05/17:15:00"/> </Feature> </Features>
</Dataset>
</Category></HazardReport> </Response> </XLS> --------- XSL FILE --------- <?xml version="1.0" encoding="UTF-16"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:gml="http://www.opengis.net/gml" xmlns:date="http://exslt.org/dates-and-times" xmlns:str="http://exslt.org/strings" xmlns:hdm="http://namespace" xmlns:css="http://www.w3.org/TR/XSL-for-CSS" xmlns="http://www.w3.org/1999/xhtml"> <xsl:template match="/"> <html> <head> <link rel="stylesheet" type="text/css" href="http://dutton:8080/insmap/styles/InsMapStyles.css"/> <link rel="stylesheet" type="text/css" href="http://dutton:8080/insmap/styles/moduleStyles.css"/> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> </head> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="GeocodeResponse"> </xsl:template> <xsl:template match="Category[@name='Tornadoes']"> <div class="block-large"> <h3 id="winds" class="tornado-header">Tornados<img src="http://dutton:8080/insmap/images/portfolio/tornado_icon.png" width="44" height="44" class="haz_icon"/> </h3> <div class="block-tornado-content"> <table width="100%" border="0" cellpadding="1" cellspacing="3"> <xsl:for-each select="Dataset"> <tr> <xsl:for-each select="descendant-or-self::Feature[1]/Attribute"> <th> <xsl:value-of select="@name"/> </th> </xsl:for-each> </tr> <tr align="center"> <xsl:for-each select="descendant-or-self::Feature[1]/Attribute"> <td> <xsl:value-of select="@value"/> </td> </xsl:for-each> </tr> <tr align="center"> <xsl:for-each select="descendant-or-self::Feature[2]/Attribute"> <td> <xsl:value-of select="@value"/> </td> </xsl:for-each> </tr> <tr align="center"> <xsl:for-each select="descendant-or-self::Feature[3]/Attribute"> <td> <xsl:value-of select="@value"/> </td> </xsl:for-each> </tr> </xsl:for-each> </table> </div> </div> </xsl:template> <xsl:template match="Category[@name='Hurricanes']"> </xsl:template> <xsl:template match="Category[@name='Wild Fires']"> </xsl:template> <xsl:template match="Category[@name='Earthquakes']"> </xsl:template> <xsl:template match="Category[@name='Flood']"> </xsl:template> <xsl:template match="Category[@name='Imagery']"> </xsl:template> </xsl:stylesheet>
|

Cart



