Subject: Re: [xsl] An approach to XSLT programming, was Re: [xsl] Dynamic variables? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 29 Nov 2010 18:16:21 -0500 |
On Sun, 28 Nov 2010 17:52:03 +0000 Michael Kay <mike@xxxxxxxxxxxx> wrote:
> In your rationale you say " > > I want to remember those "style" definitions so I can emit appropriate > code when they are referenced. > > Use of temporal language like this ("remember", "when") is always > dangerous with XSLT; it's best to avoid thinking about XSLT > computation as having a particular temporal order.
In the opposite case, we hear David C sometimes almost repeat the words of the OP and derive code from it?
Are there ways that you 'express the problem' that make it easier to write code?
<styles> <style name="basic" typeface="Optima" weight="normal" slant="roman"/> <style name="emphatic" typeface="Optima" weight="bold" slant="italic"/> </styles> . . . <p style="basic">This paragraph contains some <span style="emphatic">emphatic</span> text.</p>
<xsl:template match="style" mode="css-style"> <xsl:attribute name="style"> <xsl:apply-templates select="@*" mode="css-style"/> <xsl:attribute> </xsl:template>
<xsl:template match="@typeface" mode="css-style"> <xsl:text>font-family: </xsl:text> <xsl:value-of select="."/> <xsl:text>;</xsl:text> </xsl:template>
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 ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] An approach to XSLT programmi, Dave Pawson | Thread | Re: [xsl] Dynamic variables?, Peter Davis |
Re: [xsl] xslt test automation, Wendell Piez | Date | Re: [xsl] Limitations of including/, Michael Kay |
Month |