a global variable sure would come in handy

Discussion in 'XML' started by David Schwartz, Mar 7, 2008.

  1. I need to control how I process <foo> elements based on how I'm
    generating my HTML (separate files vs. a single large file). What can
    I use as a switch in my foo stylesheet to control how it's processed?
    Note that the output style is determined by which xsl file (which
    'include' the foo stylesheet) I process rather than being represented
    in the xml data.

    As the foo stylesheet uses the 'match' attribute, I don't know how to
    make the output style detectable within the stylesheet. If I was
    coding in other languages, I'd be tempted to use a global variable.

    TIA,
    David
    David Schwartz, Mar 7, 2008
    #1
    1. Advertising

  2. David Schwartz wrote:
    > I need to control how I process <foo> elements based on how I'm
    > generating my HTML (separate files vs. a single large file). What can
    > I use as a switch in my foo stylesheet to control how it's processed?
    > Note that the output style is determined by which xsl file (which
    > 'include' the foo stylesheet) I process rather than being represented
    > in the xml data.
    >
    > As the foo stylesheet uses the 'match' attribute, I don't know how to
    > make the output style detectable within the stylesheet. If I was
    > coding in other languages, I'd be tempted to use a global variable.


    Well XSLT knows both global variables and global parameters and with
    XSLT 2.0 you can even use them in match patterns:
    <xsl:stylesheet
    xmlns:xsl="http://wwww.w3.org/1999/XSL/Transform"
    version="2.0">

    <xsl:param name="multiple" select="true()"/>

    <xsl:template match="foo[$multiple]">
    ...
    </xsl:template>



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Mar 7, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    1
    Views:
    383
    darrel
    Mar 29, 2005
  2. Torsten Schmeissel
    Replies:
    0
    Views:
    404
    Torsten Schmeissel
    Apr 29, 2005
  3. Will Ware

    handy stacktrace class

    Will Ware, Dec 12, 2004, in forum: Python
    Replies:
    2
    Views:
    332
  4. Replies:
    0
    Views:
    540
  5. Kevin Duggan
    Replies:
    4
    Views:
    96
    Kevin Duggan
    Sep 7, 2004
Loading...

Share This Page