Re: XSLT: modularizing select condition

Discussion in 'XML' started by Martin Honnen, Aug 4, 2003.

  1. Aleksi Kallio wrote:
    > I am doing this:
    >
    > <xsl:apply-templates select="field[contains(input/@name, 'title')]" />
    > <xsl:apply-templates select="field[not (contains(input/@name,
    > 'title'))]" />
    >
    > Ie. I first apply templates to field-elements that satisfy a given
    > condition and then to rest of them. Condition will get very long and
    > complex.
    >
    > What's the easiest way to modularize the condition, to avoid duplicating
    > it?


    You can store it in a variable
    <xsl:variable ame="condition" select="contains..." />
    and then use
    <xsl:apply-templates select="field[$condition]" >
    I think



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Aug 4, 2003
    #1
    1. Advertising

  2. Martin Honnen

    Andy Fish Guest

    I bet you can't ;-)

    IMHO you would need an extension such as EXSLT's 'dynamic' to do this.

    "Martin Honnen" <> wrote in message
    news:...
    >
    >
    > Aleksi Kallio wrote:
    > > I am doing this:
    > >
    > > <xsl:apply-templates select="field[contains(input/@name, 'title')]" />
    > > <xsl:apply-templates select="field[not (contains(input/@name,
    > > 'title'))]" />
    > >
    > > Ie. I first apply templates to field-elements that satisfy a given
    > > condition and then to rest of them. Condition will get very long and
    > > complex.
    > >
    > > What's the easiest way to modularize the condition, to avoid duplicating
    > > it?

    >
    > You can store it in a variable
    > <xsl:variable ame="condition" select="contains..." />
    > and then use
    > <xsl:apply-templates select="field[$condition]" >
    > I think
    >
    >
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/
    >
     
    Andy Fish, Aug 4, 2003
    #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. -
    Replies:
    12
    Views:
    697
    Remon van Vliet
    Jun 15, 2005
  2. -berlin.de

    XSLT: Copy-of with condition

    -berlin.de, Feb 23, 2007, in forum: XML
    Replies:
    3
    Views:
    639
    -berlin.de
    Feb 26, 2007
  3. njsimha
    Replies:
    0
    Views:
    418
    njsimha
    Sep 12, 2008
  4. Bill W.
    Replies:
    13
    Views:
    295
    Phillip Gawlowski
    May 9, 2011
  5. palmiere
    Replies:
    1
    Views:
    413
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page