Re: [xsl] How to Substitute HTML template with values?

Subject: Re: [xsl] How to Substitute HTML template with values?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 4 Dec 2003 13:12:51 GMT

> href="D:\Test\XML\subst.xhtml"?>

URIs don't start with D: (unless you know of a competing protocol to
http:-) and don't use \


sometimes it will work, but if it does that is a non conforming
application being "kind" and at some point you'll come up against a
conforming application that will fail (See Ken Holman's message from a
minute ago)

  Again, my point is that I want to be able to build and design the
  page as a regular html (xhtml) doc, using standard tools.

Hm, OK. personally I wouldn't use a tool that didn't show me exactly the
markup that it was inserting (I don't trust them enough:-) but if that's
what you want I'd do a two step process (as xslt doesn't have dynamic
xpath evaluation)

1 write your template (no need for xsl:version in the html element this
time, and use the same {} syntax in element content as well as attributes.

<head><title>My Template</title></head>
  <br />Name <input type="text" value="{/mapping/NAME}" size="15"/>
  <br />Address <input type="text" value="{/mapping/ADDR}" size="15"/>
				<xsl:for-each select="/mapping/MYTABLE/ROW">

2) run stylesheet a over your template

<xsl:stylesheet xmlns:xsl="";
<xsl:template match="*">
<xsl:copy-of select="@*"/>

<xsl:template match="/*">
<xsl:copy-of select="@*"/>
<xsl:attribute name="xsl:version">1.0</xsl:version>

<xsl:template match="*[starts-with(.,'{')]">
<xsl:copy-of select="@*"/>
<xsl:element name="xsl:value-of">
<xsl:attribute name="select">
<xsl:value-of select="substring-before(substring-after(.,'{'),'}')"/>


with a bit of luck that will generate for you a stylesheet like the one
you posted, which you then

3) run this new stylesheet over your xml file.



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread