browserDetection.xslt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2008
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <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">
  9. <xsl:variable name="http-values" select="/root/http/param"/>
  10. <xsl:variable name="query-values" select="/root/env/param"/>
  11. <xsl:template match="/">
  12. <xts:sequence>
  13. <xts:append>
  14. <browserInfo>
  15. <name><xsl:value-of select="$query-values[@name='browser']"/></name>
  16. <isIE>
  17. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE')"/>
  18. </isIE>
  19. <isIE50>
  20. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE 5.0')"/>
  21. </isIE50>
  22. <isIE55>
  23. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE 5.5')"/>
  24. </isIE55>
  25. <isIE6>
  26. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'MSIE 6')"/>
  27. </isIE6>
  28. <isNS6>
  29. <xsl:value-of select="contains($http-values[@name='HTTP_USER_AGENT'], 'Mozilla/5') and (contains($http-values[@name='HTTP_USER_AGENT'], 'Gecko') or contains($http-values[@name='HTTP_USER_AGENT'], 'Netscape'))"/>
  30. </isNS6>
  31. </browserInfo>
  32. </xts:append>
  33. </xts:sequence>
  34. </xsl:template>
  35. </xsl:stylesheet>