Subject: [xsl] Dynamic creation of Frame view from XML using XSLT Regex match! From: sreejith m <msreejith@xxxxxxxxx> Date: Sun, 9 Sep 2007 10:42:01 -0700 (PDT) |
Hi All, Following is the brief problem description: ------------------------------------------- i) Need to create a normal Frame based html view (left index frame + right content frame) ii) The main content (right frame) is generated by rendering a XML document using xsl transformation iii) At the same time the left frame should be populated based on certain TAG name matches from the same XML document which in turn would be hyperlinks to the main content frame For eg) the html should look like: ----------------------------------- ====================================== T_SYS | T_SYS T_MB | --html table for t_sys here | -- | -- | T_MB | --html table for t_mb here ====================================== The format of the XML document is: ---------------------------------- <XMLDOC> <T_SYS> <T_SYS_ROW> <acol> aval </acol> <bcol> bval </bcol> <T_SYS_ROW> <T_SYS_ROW> <acol> aval </acol> <bcol> bval </bcol> </T_SYS_ROW> </T_SYS> <T_MB> <T_MB_ROW> <acol> aval </acol> <bcol> bval </bcol> </T_MB_ROW> <T_MB_ROW> <acol> aval </acol> <bcol> bval </bcol> </T_MB_ROW> </T_MB> </XMLDOC> -------------------------------- The XSL currently applied (for content rendering) is: -------------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> <xsl:template match="/*"> <html> <head> <title><xsl:value-of select="name()"/></title> <style type="text/css"> table { font-family: Arial, sans-serif; } th { font-size: 75%; background: #4D5D97; color: #FFFFFF; } td { vertical-align: top; } .odd { background: #E3E4FA; } .evn { background: #E7ECF0; } </style> </head> <body> <xsl:for-each select="/*/*"> <h1><xsl:value-of select="name()"/></h1> <xsl:apply-templates select="." mode="table"/> </xsl:for-each> </body> </html> </xsl:template> <xsl:template match="*" mode="table"> <table border="0"> <tr> <xsl:apply-templates select="*[1]/descendant::*[not(*)]" mode="th"/> </tr> <xsl:apply-templates select="*" mode="tr"/> </table> </xsl:template> <xsl:template match="*" mode="th"> <th><xsl:value-of select="name()"/></th> </xsl:template> <xsl:template match="*" mode="tr"> <xsl:variable name="class"> <xsl:choose> <xsl:when test="(position() mod 2 = 1)">odd</xsl:when> <xsl:otherwise>evn</xsl:otherwise> </xsl:choose> </xsl:variable> <tr class="{$class}"> <xsl:apply-templates select="descendant::*[not(*)]" mode="td"/> </tr> </xsl:template> <xsl:template match="*" mode="td"> <td><xsl:value-of select="."/></td> </xsl:template> </xsl:stylesheet> -------------------------------------------------- Kindly let me know how to achieve the final output. thanks Sreejith ____________________________________________________________________________________ Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. http://mobile.yahoo.com/go?refer=1GNXIC
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] number of particular sub , Martin Honnen | Thread | Re: [xsl] Dynamic creation of Frame, Abel Braaksma |
Re: [xsl] XML structure to HTML uno, Abel Braaksma | Date | Re: [xsl] Dynamic creation of Frame, Abel Braaksma |
Month |