[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: "Jim Fuller" <jim.fuller@xxxxxxxxxxxxxx>
Date: Sun, 29 Feb 2004 23:18:07 -0000
embedded boiler

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Karl J. Stubsjoen
> Sent: 29 February 2004 21:45
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  Thinking Out loud - XML or XSL for boiler messages
> 
> 
> 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).

A more elegant way would be to have a separate xml file with lookup
values

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

Lookup xml file ( lookup.xml )
<?xml version="1.0" ?>
<resource>
<firstname>Jim</firstname>
</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:variable name="lookup-data"
select="document('lookup.xml')"/>
	<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="*">
	<xsl:variable name="currentname" select="local-name()"/>
		<xsl:value-of
select="$lookup-data/resource/child::*[local-name()=$currentname]"/>
	</xsl:template>
</xsl:stylesheet>

This lets u generate a lookup file to refer to, without generating a
whole bunch of xsl:templates...though u could use this technique with
xsl:param. This assumes though that you have no useful markup embedded
in your text other then tokens to be replaced, though you could easily
handle this by either using a namespace on the elements and a general
matching template for those, for example html:* elements could be
embedded in text with a matching xsl:template to just process them
normally...up to you.

Once again there are other methods.

gl, Jim


 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.