RSUpgradePageSetup.xsl 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: rspecupgrade
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!-- COPYRIGHT_DATA { 'YEAR':[2005, 2009], 'RELEASE':['colorado_wave1'], 'VISIBLE':'YES', 'COMPONENT':'rspecupgrade' }-->
  10. <!--All lines above the COPYRIGHT_DATA line will be replaced when copyright notices are generated. -->
  11. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:baltic="http://developer.cognos.com/schemas/report/1/" xmlns="http://developer.cognos.com/schemas/report/2.0/" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xalan/java" extension-element-prefixes="xalan date exsl" exclude-result-prefixes="xalan java baltic date exsl">
  12. <xsl:template match="baltic:pageSetup">
  13. <pageSetup orientation="{@orientation}">
  14. <xsl:variable name="v_after">@name='</xsl:variable>
  15. <xsl:variable name="v_before">']</xsl:variable>
  16. <xsl:variable name="v_name">
  17. <xsl:choose>
  18. <xsl:when test="starts-with(@name, '/')">
  19. <!-- Normally, the name is a path to a pageSetup object in CM and looks like this: /configuration/pageDefinition[@name='Legal'] -->
  20. <xsl:value-of select="substring-before(substring-after(@name, $v_after),$v_before)"/>
  21. </xsl:when>
  22. <xsl:otherwise>
  23. <!-- Otherwise, use the name as is. -->
  24. <xsl:value-of select="@name"/>
  25. </xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:variable>
  28. <xsl:variable name="v_width" select="@width"/>
  29. <xsl:variable name="v_height" select="@height"/>
  30. <xsl:variable name="v_unit" select="@unit"/>
  31. <xsl:variable name="v_namedPaper">
  32. <xsl:choose>
  33. <xsl:when test="count(@width) = 0 or count(@height) = 0">true</xsl:when>
  34. <xsl:when test="$v_width = '' or $v_height = ''">true</xsl:when>
  35. <xsl:when test="$var_paperSize//*[local-name()='namedPaper' and @name=$v_name and @width=$v_width and @height=$v_height and @unit = $v_unit]">true</xsl:when>
  36. <xsl:otherwise>false</xsl:otherwise>
  37. </xsl:choose>
  38. </xsl:variable>
  39. <xsl:choose>
  40. <xsl:when test="$v_namedPaper = 'true'">
  41. <namedPaper name="{@name}"/>
  42. </xsl:when>
  43. <xsl:otherwise>
  44. <customPaper width="{@width}" height="{@height}" unit="{@unit}"/>
  45. </xsl:otherwise>
  46. </xsl:choose>
  47. </pageSetup>
  48. </xsl:template>
  49. </xsl:stylesheet>