[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: translate to XML using XSL into an HTML table
Abel, thank you so much for your helpful explanation. I tried and tried your example and could not get it to compile. Will you kindly help? <xsl:template match="/"> <!-- here comes your frameword for the html page --> <html> <head>.....</head> .... etc .... <body> <!-- now we tell the processor what main elements to grab --> <!-- these are children of the root --> <xsl:apply-templates select="PHONEBOOK" /> </body> </body> </xsl:template> <!-- declaring the table, which starts for each PHONEBOOK (only one) --> <xsl:template match="PHONEBOOK"> <!-- here comes the start of the table, you could put it in the main, but this keeps it cleaner --> <table border="3"> <!-- table header --> <tr bgcolor="lightblue"> <th>FirstName</th> <th>LastName</th> <th>Phone</th> </tr> <!-- here we say to the processor: take these elements that we want a rows --> <!-- I assume that you have added a <member> around each first/last/phone, though this is not necessary --> <xsl:apply-template select="MEMBER" /> </table> </xsl:template> <!-- declaring the row, which the processor will automatically select for each MEMBER --> <xsl:template match="MEMBER"> <!-- here goes the row definition all is a client of MEMBER now --> <!-- an easy way to create a way so you can point your browser to each member by its id or name (IE), by using http://yoururl/yourpath#memberID --> <xsl:variable name="id"><xsl:number /></xsl:variable> <tr id="member-{$id}"> <xsl:apply-templates select="FIRST | LAST | PHONE" /> </tr> </xsl:template> <!-- declare the cells, which is any node that is a child of MEMBER --> <xsl:template match="MEMBER/*"> <!-- here we select the value of the current node (.) --> <td><xsl:value-of select="." /></td> </xsl:template> </html> ____________________________________________________________________________________ Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|