[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Suggestions

  • From: Scott Deboy <SCODEB@s...>
  • To: 'James Tauber' <jtauber@j...>
  • Date: Wed, 14 Apr 1999 08:19:59 -0700

engagement party thank you
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.  

Scott

> ----------
> From: 	James Tauber[SMTP:jtauber@j...]
> Sent: 	 April 13, 1999 10:42 PM
> To: 	Scott Deboy
> Cc: 	'xml-dev@i...'
> 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
> 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:
> 
> <Person wedding="yes">
>   <Name>John</Name>
>   <Gift>vase</Gift>
> </Person>
> 
> 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:choose>
>     <xsl:when test='.[wedding="yes"]'>
>       <P>Look forward to seeing you at the wedding.</P>
>     </xsl:when>
>   <xsl:choose>
>   <P>James</P>
> </xsl:template>
> 
> Is this the sort of thing you wanted to do?
> 

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.