Advertisement
Guest User

Untitled

a guest
Jul 1st, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. <root xmlns:x1="url1" xmlns:x2="url2" ... xmlns:xN="urlN">
  2. <childNode1/>
  3. ...
  4. <childNodeN/>
  5. </root>
  6.  
  7. <namespace node="root">
  8. <x1>url1</x1>
  9. <x2>url2</x2>
  10. ...
  11. <xN>urlN</xN>
  12. </namespace>
  13.  
  14. <xsl:template match="root">
  15. <namespace>
  16. <xsl:attribute name="node">
  17. <xsl:value-of select="name()"/>
  18. </xsl:attribute>
  19. <xsl:for-each select="@*[contains(name(),'xmlns')]">
  20. <xsl:element name="{substring-after(name(),':')}">
  21. <xsl:value-of select="."/>
  22. </xsl:element>
  23. </xsl:for-each>
  24. </namespace>
  25. </xsl:template>
  26.  
  27. <xsl:for-each select="namespace::*">
  28. <xsl:element name="{name()}">
  29. <xsl:value-of select="."/>
  30. </xsl:element>
  31. </xsl:for-each>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement