xsl-list
[Top] [All Lists]

Re: [xsl] Different conditional outputs in same Stylesheet or calling another stylesheet (version 1.0, Xalan)

2008-02-27 03:59:39
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--