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

Re: Different conditional outputs in same Stylesheet o

Subject: Re: Different conditional outputs in same Stylesheet or calling another stylesheet (version 1.0, Xalan)
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Wed, 27 Feb 2008 11:59:08 +0100 (CET)
Re:  Different conditional outputs in same Stylesheet o
Pankaj Chaturvedi wrote:

  Hi

> I am writing a stylesheets for different journal
> (basically for print), wherein the order of authors,
> titles etc varies (<ref-book> here)depending upon the
> <journalcode>.

  Depending on the amount of differences between the various
versions, you might want to use on of the following (from
less to more differences).

  1/ For simple differences between the various formats to
generate, you can use different template rules:

    <xsl:template match="journalcode = 'A'">
       <something>
          <xsl:apply-templates/>
       </something>
    </xsl:template>

    <xsl:template match="journalcode = 'B'">
       <something-else>
          <xsl:apply-templates/>
       </something-else>
    </xsl:template>

  2/ If a lot of the processing will depend on that value,
you can use different modes, one per case:

    <xsl:template match="journalcode = 'A'">
       <xsl:apply-templates select="." mode="in-a"/>
    </xsl:template>

    <xsl:template match="journalcode = 'B'">
       <xsl:apply-templates select="." mode="in-b"/>
    </xsl:template>

    <xsl:template match="journalcode" mode="in-a">
       ...
    </xsl:template>

    <xsl:template match="..." mode="in-a">
       ...
    </xsl:template>

    <xsl:template match="journalcode" mode="in-b">
       ...
    </xsl:template>

    <xsl:template match="..." mode="in-b">
       ...
    </xsl:template>

  3/ You can put each mode in a separate stylesheet module
for editorial clarity.

  4/ If you know which case you want to use before launching
the transform, you can make a different module for each
case, containing what is specific for this case, and each
specific module importing common modules.  Then you use
the appropriate module for each transform.

  Regards,

--drkm























      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

Current Thread

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
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.