[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: And I'd like that in triplicate...
Jeremy,
Adding to what Ken said.... The first decision you'll have to make is whether you want the three copies as a single PDF, or as multiple PDFs. If the former, you will would most likely generate each of the three copies as a separate page-sequence. In that case your stylesheet would having something logically like this: <xsl:template match="/"> <fo:root> <xsl:call-template name="page-architecture"/> <xsl:apply-templates> <xsl:with-param name="copy" select="'merchant'"/> </xsl:apply-templates> <xsl:apply-templates> <xsl:with-param name="copy" select="'customer'"/> </xsl:apply-templates> <xsl:apply-templates> <xsl:with-param name="copy" select="'file'"/> </xsl:apply-templates> </fo:root> </xsl:template> where a page sequence results from each apply-templates traversal. In other words, perform the same logic three times, but pass a parameter in to differentiate between them. Then, when you generate your content, you test against the value of your parameter to determine which copy you're making. This is easier to implement in XSLT 2.0, which has a feature called "tunnel parameters", which allows you to avoid having to pass your parameters explicitly through every template you use. This is cumbersome, but unfortunately necessary in XSLT 1.0. If you want three separate PDFs, you can declare your parameters at the top level and pass them in at runtime. This is a bit easier in 1.0, since global parameters are available in every template and thus don't have to be passed through explicitly. To run this, you'd simple invoke your stylesheet on your document three times, setting the parameter value differently for each. Either way, the answer to the question "How do I do exactly the same thing with minor exceptions three ways" is simply to do the thing three times, using a parameter to drive the differentiations. Look up xsl:param and xsl:with-param for more. Use tunnel parameters in XSLT 2.0 if you can. Cheers, Wendell At 02:49 PM 3/19/2008, you wrote: At 2008-03-19 12:50 -0500, Ferry, Jeremy wrote:I've got a xsl-fo stylesheet that I've created to output an xml document as a PDF but I'm having trouble figuring out how I would produce multiple copies, each one having only minor differences in some static content. Think of it like a credit card receipt - one copy for the merchant and one for the customer - the only difference being the text that says "Merchant Copy" or "Customer Copy". ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|