[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: global language parameter
Dear Charles,
In addition to everything you've done, I would suggest you now consider refactoring this logic into a dedicated mode. That is, instead of At 04:02 AM 2/15/2010, you wrote: <xsl:template name="add-style"> ... etc ... you have <xsl:template match="*[@rend='indent']" mode="add-style"> <xsl:text>text-indent:12mm; margin-top: 0;margin-bottom: 0; </xsl:text> <xsl:text>line-height:9mm;</xsl:text> </xsl:template> <xsl:template match="*[@rend='plain']" mode="add-style"> <xsl:text>text-indent:0;margin-left:0; margin-top:0;</xsl:text> <xsl:text>margin-bottom: 0; line-height:9mm;</xsl:text> </xsl:template> <xsl:template match="*[@rend='blockquote']" mode="add-style"> <xsl:text>text-indent:0;margin-left:12mm; margin-top:1em;</xsl:text> <xsl:text>margin-bottom: 1em; margin-right: 2em;</xsl:text> <xsl:text>line-height:9mm;</xsl:text> </xsl:template> Then it's simply a matter of having <xsl:attribute name="style"> <xsl:apply-templates select="." mode="add-style"/> </xsl:attribute> I would argue this is a bit cleaner and more extensible, in addition (perhaps) to performing better, than a long choose/when/otherwise. You can go further with this also. For example, a dedicated mode could add the font styling based on language, too, using the lang() function to discriminate matches. And you can distinguish easily between properties added only to block elements (margins and such) vs properties added to both blocks and inlines. Finally, you might consider abstracting the regularities between the styles -- in this case, probably into named templates, which are good when boilerplate is really boilerplate. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|