[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Rendering an HTML table twice
Lee, >I have an HTML table in an XML doc which I wish to render >twice, once in the main doc with small fonts, once in a >pop-up window with large fonts. Jeni kindly provided >assistance and code to render the TABLE element, and now >I can't render the TR/TD elements. If you remember, the TABLE elements didn't work because you were including them as elements within your attribute value. Similarly, any other element you put in won't work because elements within attribute values are ignored. What you need to do is *serialise* the 'HTML' that you're producing, so that you construct something that outputs: <tr>...</tr> and not: <tr>...</tr> If you look at the code that I gave you for creating the A element, you'll see that the trs are having templates applied to them in 'serialise' mode. The point of the 'serialise' mode is to serialise the trs so that they get output in the right way. In the post that I sent, I gave you a template to do that: <xsl:template match="*" mode="serialise"> <xsl:text /><<xsl:value-of select="name()" /> <xsl:for-each select="@*"> <xsl:text> </xsl:text> <xsl:value-of select="name()" /> <xsl:text />="<xsl:value-of select="." />"<xsl:text /> </xsl:for-each> <xsl:text>></xsl:text> <xsl:apply-templates mode="serialise" /> <xsl:text /></<xsl:value-of select="name()" />><xsl:text /> </xsl:template> If you put that in the stylesheet, then it will create serialised copies of the tr and td elements in your source as they stand. If you want to do something special with trs, like add the VALIGN attribute, then you should *also* have a special template that produces that: <xsl:template match="tr" mode="serialise"> <!-- beginning start tag here --> <xsl:text /><<xsl:value-of select="name()" /> <!-- adding VALIGN attribute here --> <xsl:text> VALIGN="center"</xsl:text> <!-- adding other attributes here --> <xsl:for-each select="@*"> <xsl:text> </xsl:text> <xsl:value-of select="name()" /> <xsl:text />="<xsl:value-of select="." />"<xsl:text /> </xsl:for-each> <xsl:text>></xsl:text> <!-- adding serialised content here --> <xsl:apply-templates mode="serialise" /> <!-- putting in end tag here --> <xsl:text /></<xsl:value-of select="name()" />><xsl:text /> </xsl:template> Does that make more sense? Cheers, Jeni Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|