embedding html tags in xsl?
Hi all, I've been seeing lots of examples of xsl stylesheets where html tags are placed (hard-coded?) in the xsl style sheet. For example, I've seen: <xsl:template match="/"> <HTML> <BODY BGCOLOR="#808080"> <H1>Product List</H1> <B> <xsl:value-of select="product"/> </B> </BODY> </HTML> </xsl:template> The same can also be done for components such as buttons, text area, etc. My concern is that once html tags are introduced into a style sheet, its flexibility has been compromised, and that xsl style sheet can only be used to output html. An improvement on the above might be something like: <xsl:template match="/"> <xsl:element name="html"> <xsl:element name="body"> <xsl:attribute name="bgcolor">#808080<xsl:attribute/> <xsl:element name="h1">Product List</xsl:element> <xsl:element name="br"> <xsl:value-of select="product"/> </xsl:element> </xsl:element> </xsl:element> </xsl:template> While this is more of a pure xsl solution, it still requires the output target to support an element named "html" or "body", etc. From a design standpoint how can I not lock myself into writing an html specific stylesheet? My understanding is that an xsl style sheet should be generic enough to handle any output (simply change the xsl:output, right?). Are we just not there yet? Perhaps some notion of a meta-tag that describes some xsl elements? Do I have to wait for total support for formatting objects before I can be this flexible? Can anyone shed light on this? Share some opinions? Thanks - Jerry 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