[xsl] How to Substitute HTML template with values?

Subject: [xsl] How to Substitute HTML template with values?
From: Amir Yiron <amir@xxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Dec 2003 12:37:14 +0200
Hi,

I'm looking for a method to make the following by XSLT:
Input: XHTML template doc, XML value mapping doc, XSLT doc
Output: XHTML doc, based on XHTML template, filled with value from the XML
file.

In other words, I want to make copy with substitutions.
The main point here is that the XHTML is an external template, instead of
being embedded
into the XSLT doc! (that helps me to design the XHTML without touching the
XSLT).

for example:

XHTML Template:
<html>
<head><title>My Template</title></head>
<body>
  <br />Name <input type="text" value="@@@NAME@@@" size="15"/>
  <br />Address <input type="text" value="@@@ADDR@@@" size="15"/>
</body>
</html>

XML Doc:
<mapping>
  <@@@NAME@@@>My Name</@@@NAME@@@>
  <@@@ADDR@@@>My Address</@@@NAME@@@>
</mapping>

XHTML Output:
<html>
<head><title>My Template</title></head>
<body>
  <br />Name <input type="text" value="My Name" size="15"/>
  <br />Address <input type="text" value="My Address" size="15"/>
</body>
</html>

What is the XSLT for doing such?

This is a very simple example, of course. Next step is template for
tables...

Thanks,
-- Amir

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


Current Thread