xsl-list
[Top] [All Lists]

Re: How to Substitute HTML template with values?

2003-12-04 04:00:52


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


That's not XML, XML element names can not have @

If you changed your names to well formed XML you could program this in
xslt, or if you are prepared to change your syntax just a bit you could
use the "literal result element as stylesheet" syntax

xmldoc:

<mapping>
  <NAME>My Name</NAME>
  <ADDR>My Address</NAME>
</mapping>

stylesheet == XHTML template

<html xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xsl:version="1.0">
<head><title>My Template</title></head>
<body>
  <br />Name <input type="text" value="{/mapping/NAME}" size="15"/>
  <br />Address <input type="text" value="{/mapping/ADDR}" size="15"/>
</body>
</html>


that is all you need have is an xsl:version attribute in your html
element then you can use AVT templates to pull things into attributes (or
any xsl instruction such as xsl:value-of to pull things into elements)


David

-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

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



<Prev in Thread] Current Thread [Next in Thread>