[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: RE: Thinking Out loud - XML or XSL for boiler messages
From: "Karl J. Stubsjoen" <karl@xxxxxxxxxxxxx>
Date: Sun, 29 Feb 2004 14:45:25 -0700
boiler xml
Precisely what I was looking for...
I've asked similar question before, but because the data I was retrieving
was wrapped within an attribute this sort of template processing would not
work.  At this point, I do not have this trouble, the XML source is 100% my
conception (the other is an ADO XML recordset).

Thanks Jim... will put this to use now!

Karl

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Jim Fuller
Sent: Sunday, February 29, 2004 1:12 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Thinking Out loud - XML or XSL for boiler messages


> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Karl J. Stubsjoen
> Sent: 29 February 2004 15:52
> Subject:  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" ?>
<resource>
<para>Dr <firstname/>, Please read this letter</para>
</resource>

xsl file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method = "html"/>
	<xsl:template match="resource">
		<html>
			<title></title>
			<body>
			<xsl:apply-templates select="para"/>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="para">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="firstname">
		Jim
	</xsl:template>
</xsl:stylesheet>

Will print out

<html>
<title></title>
<body>Dr
		Jim
	, Please read this letter</body>
</html>

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"/>
</xsl:template>

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:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.