Lists Home |
Date Index |
- From: James Tauber <email@example.com>
- To: Scott Deboy <SCODEB@saif.com>
- Date: Wed, 14 Apr 1999 13:42:56 +0800
Scott Deboy wrote:
> I'm new to XML (reading the spec and learning about DTDs etc.) and I was
> hoping someone could point me in the right direction on an idea I have to
> replace Word macros w/a 3-tier system using XML.
> Example: I want to build a letter macro using XML.
> The letter is mostly static text. An address is required, as well as a
> couple of other fields. Also, the letter has a couple of optional
> paragraphs that I need to prompt the user to answer.
A better approach would be to represent the user provided information as
an XML document which is then given to an XSL engine to add the static
text. So your template/macro would be a combination of a DTD
constraining user-provided information, and an XSL stylesheet that takes
that information and produces the output.
Here's a really simple example.
Say you are writing thank you notes for an engagement party.
For each person you have a document like:
that indicates the person's name, what gift they gave and whether they
are coming to the wedding. Here's a DTD:
<!ELEMENT Person (Name,Gift)>
<!ATTLIST wedding (yes|no) #REQUIRED>
<!ELEMENT Name (#PCDATA)>
<!ELEMENT Gift (#PCDATA)>
You then have an XSL stylesheet with a template such as:
<P>Dear <xsl:value-of select="Name"/>,</P>
<P>Thank you so much for your <xsl:value-of select="Gift"/>.</P>
<P>Look forward to seeing you at the wedding.</P>
Is this the sort of thing you wanted to do?
xml-dev: A list for W3C XML Developers. To post, mailto:firstname.lastname@example.org
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:email@example.com the following message;
To subscribe to the digests, mailto:firstname.lastname@example.org the following message;
List coordinator, Henry Rzepa (mailto:email@example.com)