Login 
 
 Pref   Your subscriptions   Home   Help 
users@ml.mod-xslt2.com
mod-xslt2 - Users Mailing List
   
 
List info
 
 
 
Subscribe
 
 
Unsubscribe
 
 
Archive
 
 
Post
 



Advanced search
2004 01 02 03 04 05 06 07 08 09 10 11 12
2005 01 02 03 04 05 06 07 08 09 10 11 12
2006 01 02 03 04 05 06 07 08 09 10 11 12
2007 01 02 03 04 05 06 07 08 09 10 11 12
2008 01 02 03 04 05 06 07 08 09 10 11 12

  previous   Chronological   next       previous   Thread       

Re: [mod-xslt users] browser detection? Carlo Contavalli
  • From: Carlo Contavalli <ccontavalli@xxxxxxxxxxx>
  • To: users@xxxxxxxxxxxxxxxx
  • Subject: Re: [mod-xslt users] browser detection?
  • Date: Sat, 25 Sep 2004 11:29:17 +0200
  • References: <232FB0A1-0E6E-11D9-93EE-000A95DBC476@mail.arc.nasa.gov> <4EE9A339-0E7E-11D9-93EE-000A95DBC476@mail.arc.nasa.gov> <DE1129F0-0E83-11D9-93EE-000A95DBC476@mail.arc.nasa.gov>


  • On Fri, Sep 24, 2004 at 04:45:51PM -0700, Ryan C.Spaulding wrote:
    > Is there anyway to do an if $HEADER[User-Agent] =~ /mozilla/ then do
    > this otherwise do that?
    In your .xml document, you can use multiple
    <?modxslt-stylesheet ...
    to choose the stylesheet to use. The first one matching is used.
    From a logical point of view, this leads to someghing like:
    if(condition) then use(stylesheet);
    else if(condition) then use(stylesheet);
    else if(condition) then ...

    From your .xsl file, I believe you can use something like:

    <xsl:variable name="pippo">
    <yaslt:value-of select="$HEADER[User-Agent]" />
    </xsl:variable>

    <xsl:choose>
    <xsl:when test="$pippo = '...'">
    </xsl:when>

    <xsl:when test="...">
    </xsl:when>

    <xsl:otherwise>
    </xsl:otherwise>
    </xsl:choose>

    In this case, however, you are bound to using only xslt constructs,
    so no modxslt regular expressions :(...

    Cheers,
    Carlo

    --
    GPG Fingerprint: 2383 7B14 4D08 53A4 2C1A CA29 9E98 5431 1A68 6975
    -------------
    In a whiskey it's age, in a cigarette it's taste and in a sports car
    it's impossible.

      Powered by Sympa