[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
> -----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
|
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
|