RE: [xsl] Thinking Out loud - XML or XSL for boiler messages

Subject: RE: [xsl] Thinking Out loud - XML or XSL for boiler messages
From: "Jim Fuller" <jim.fuller@xxxxxxxxxxxxxx>
Date: Sun, 29 Feb 2004 20:12:29 -0000
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Karl J. Stubsjoen
> Sent: 29 February 2004 15:52
> Subject: [xsl] Thinking Out loud - XML or XSL for boiler messages

> The XML problem:
> If messages are stored in a simple XML document, then I face 
> the challenge of how to insert additional information into 
> the XML when transforming.  For
> example:  the messages are generic, and might look like this 
> in the xml source.. "Dear [first_name], we apologize in the 
> delay for blah blah.." where [first_name] needs to be 

xml file
<?xml version="1.0" ?>
<para>Dr <firstname/>, Please read this letter</para>

xsl file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
	<xsl:output method = "html"/>
	<xsl:template match="resource">	
			<xsl:apply-templates select="para"/>
	<xsl:template match="para">
	<xsl:template match="firstname">

Will print out 

	, Please read this letter</body>

Don't worry about the whitespace for now,

This method can be extended which takes in data via xsl:param, so u
would define an <xsl:param name="firstname"/> and pass the value to the
XSLT processor, then this would result in a simple amendment of
firstname matching template

<xsl:template match="firstname">
	<xsl:value-of select="$firstname"/>

More modularity can be achieved by having these matching templates in a
separate xslt file and then use xsl:import or xsl:include to bring them
into your stylesheets.

This is just one simple way of doing it, there are a few other more
extensible methods, for example you could define all your data in
multiple xml files....

gl, Jim Fuller

 XSL-List info and archive:

Current Thread