browserDetection.xslt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xsl xts">
  13. <xsl:variable name="http-values" select="/root/http/param"/>
  14. <xsl:variable name="query-values" select="/root/env/param"/>
  15. <xsl:template match="/">
  16. <xts:sequence>
  17. <xts:append>
  18. <browserInfo>
  19. <name><xsl:value-of select="$query-values[@name='browser']"/></name>
  20. <isIE>
  21. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE')"/>
  22. </isIE>
  23. <isIE55>
  24. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE 5.5')"/>
  25. </isIE55>
  26. <isIE6>
  27. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE 6')"/>
  28. </isIE6>
  29. <isNS6>
  30. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'Mozilla/5') and (not(contains($http-values[@name='HTTP_USER_AGENT'], 'like Gecko'))) and (contains($http-values[@name='HTTP_USER_AGENT'], 'Gecko') or contains($http-values[@name='HTTP_USER_AGENT'], 'Netscape'))"/>
  31. </isNS6>
  32. </browserInfo>
  33. </xts:append>
  34. </xts:sequence>
  35. </xsl:template>
  36. </xsl:stylesheet>