Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  2. <soapenv:Body>
  3. <root>
  4. <MyElement>content</MyElement>
  5. </root>
  6. </soapenv:Body>
  7. </soapenv:Envelope>
  8.  
  9. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  10. <soapenv:Body>
  11. <root>
  12. <NEW xmlns="http://ws.apache.org/ns/synapse">content</NEW>
  13. </root>
  14. </soapenv:Body>
  15. </soapenv:Envelope>
  16.  
  17. <xsl:stylesheet xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:avintis="http://www.avintis.com/esb" extension-element-prefixes="avintis" version="2.0" exclude-result-prefixes="#all" xpath-default-namespace="">
  18. <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
  19.  
  20. <xsl:template match="/soapenv:Envelope|soapenv:Body">
  21. <xsl:copy>
  22. <xsl:apply-templates select="*|text()|@*"/>
  23. </xsl:copy>
  24. </xsl:template>
  25.  
  26. <xsl:template match="root">
  27. <xsl:copy>
  28. <!-- FIRST METHOD - THE METHOD I want to use! this will receive the xmlns="http://ws.apache.org/ns/synapse" -->
  29. <NEW>
  30. <xsl:value-of select="MyElement"/>
  31. </NEW>
  32. <!-- Second methodworks - but I need to add xmlns="" to every element and there are a lot-->
  33. <NEW xmlns="">
  34. <xsl:value-of select="MyElement"/>
  35. </NEW>
  36. <!-- Third method works: But not very readable - I would prefer the first method -->
  37. <xsl:element name="NEW">
  38. <xsl:value-of select="MyElement"/>
  39. </xsl:element>
  40. </xsl:copy>
  41. </xsl:template>
  42. </xsl:stylesheet>
  43.  
  44. <xsl:stylesheet xmlns="" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:avintis="http://www.avintis.com/esb" extension-element-prefixes="avintis" version="2.0" exclude-result-prefixes="#all" xpath-default-namespace="">
  45. <xsl:output method="xml" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
  46.  
  47. <xsl:template match="/soapenv:Envelope|soapenv:Body">
  48. <xsl:copy>
  49. <xsl:apply-templates select="*|text()|@*"/>
  50. </xsl:copy>
  51. </xsl:template>
  52.  
  53. <xsl:template match="root">
  54. <xsl:copy>
  55. <!-- FIRST METHOD - THE METHOD I want to use! this will receive the xmlns="http://ws.apache.org/ns/synapse" -->
  56. <NEW>
  57. <xsl:value-of select="MyElement"/>
  58. </NEW>
  59. <!-- Second methodworks - but I need to add xmlns="" to every element and there are a lot-->
  60. <NEW xmlns="">
  61. <xsl:value-of select="MyElement"/>
  62. </NEW>
  63. <!-- Third method works: But not very readable - I would prefer the first method -->
  64. <xsl:element name="NEW">
  65. <xsl:value-of select="MyElement"/>
  66. </xsl:element>
  67. </xsl:copy>
  68. </xsl:template>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement