Lists Home |
Date Index |
- From: Scott Deboy <SCODEB@saif.com>
- To: 'James Tauber' <firstname.lastname@example.org>
- Date: Wed, 14 Apr 1999 08:19:59 -0700
Thanks for the suggestions, James
Yes, this is 80% of what I'm looking for. The other 20% is:
If I could 'include' a reference to the optional paragraph (which will live
in a database) instead of directly embedding it in the XSL template (I want
to reuse the same optional paragraph in a number of documents).
What if I store the paragraph references as database selects in the XSL
template and do the work of retrieving them from the database before the XSL
engine does its work? Is there a better way?
It sounds like it's time to read up on XSL.
> From: James Tauber[SMTP:email@example.com]
> Sent: April 13, 1999 10:42 PM
> To: Scott Deboy
> Cc: 'firstname.lastname@example.org'
> Subject: Re: Suggestions
> 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
> > 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:
> <Person wedding="yes">
> 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:
> <xsl:template match="Person">
> <P>Dear <xsl:value-of select="Name"/>,</P>
> <P>Thank you so much for your <xsl:value-of select="Gift"/>.</P>
> <xsl:when test='.[wedding="yes"]'>
> <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:email@example.com
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:firstname.lastname@example.org the following message;
To subscribe to the digests, mailto:email@example.com the following message;
List coordinator, Henry Rzepa (mailto:firstname.lastname@example.org)