validate-wsrp-wsdl.xslt 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  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"
  13. xmlns:bind="urn:oasis:names:tc:wsrp:v1:bind"
  14. xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  15. xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  16. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  17. xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/">
  18. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  19. <!--
  20. wsdl:definitions
  21. wsdl:service @name="WSDLService"
  22. wsdl:port
  23. soap:address @location
  24. - must have targetNamespace="urn:oasis:names:tc:wsrp:v1:wsdl"
  25. - must have wsdl:service name="WSRPService"
  26. - must have between 2 and 4 ports
  27. - must have wsdl:port name="WSRPBaseService"
  28. - must have wsdl:port name="WSRPServiceDescriptionService"
  29. - can have wsdl:port name="WSRPRegistrationService"
  30. - can have wsdl:port name="WSRPPortletManagementService"
  31. - must contain soap:address
  32. - soap:address @location must not be empty
  33. -->
  34. <xsl:variable name="wsrp-wsdl-ns">urn:oasis:names:tc:wsrp:v1:wsdl</xsl:variable>
  35. <xsl:variable name="wsrp-service" select="/wsdl:definitions/wsdl:service[@name = 'WSRPService']"/>
  36. <xsl:variable name="wsrp-markup" select="$wsrp-service/wsdl:port[@name = 'WSRPBaseService']"/>
  37. <xsl:variable name="wsrp-description" select="$wsrp-service/wsdl:port[@name = 'WSRPServiceDescriptionService']"/>
  38. <xsl:variable name="wsrp-registration" select="$wsrp-service/wsdl:port[@name = 'WSRPRegistrationService']"/>
  39. <xsl:variable name="wsrp-management" select="$wsrp-service/wsdl:port[@name = 'WSRPPortletManagementService']"/>
  40. <xsl:template match="/">
  41. <xsl:choose>
  42. <xsl:when test="xtse:error">
  43. <xsl:copy-of select="xtse:error"/>
  44. </xsl:when>
  45. <xsl:when test="not($wsrp-service) or /wsdl:definitions/@targetNamespace != $wsrp-wsdl-ns">
  46. <error>
  47. <message><xts:string id="IDS_PAD_EDIT_ERROR_NOTWSRP"/></message>
  48. </error>
  49. </xsl:when>
  50. <xsl:when test="not($wsrp-markup) or $wsrp-markup/soap:address/@location = ''">
  51. <error>
  52. <message><xts:string id="IDS_PAD_EDIT_ERROR_MISSINGINTERFACES"/></message>
  53. </error>
  54. </xsl:when>
  55. <xsl:when test="not($wsrp-description) or $wsrp-description/soap:address/@location = ''">
  56. <error>
  57. <message><xts:string id="IDS_PAD_EDIT_ERROR_MISSINGINTERFACES"/></message>
  58. </error>
  59. </xsl:when>
  60. <xsl:when test="$wsrp-registration and ($wsrp-registration/soap:address/@location = '')">
  61. <error>
  62. <message><xts:string id="IDS_PAD_EDIT_ERROR_MISSINGINTERFACES"/></message>
  63. </error>
  64. </xsl:when>
  65. <xsl:when test="$wsrp-management and ($wsrp-management/soap:address/@location = '')">
  66. <error>
  67. <message><xts:string id="IDS_PAD_EDIT_ERROR_MISSINGINTERFACES"/></message>
  68. </error>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <xsl:copy-of select="wsdl:definitions"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </xsl:template>
  75. </xsl:stylesheet>