code_junkie

xsl create xmlns:xsi namespace and attribute

Nov 13th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <exercises xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="mySchema.xsd">
  2.  
  3. <xsl:element name="excercises">
  4. <xsl:attribute name="xmlns:xsi" namespace="http://www.w3.org/2001/XMLSchema-instance"/>
  5.  
  6. <excercises xp_0:xsi="" xmlns:xp_0="http://www.w3.org/2001/XMLSchema-instance">
  7.  
  8. <?xml version="1.0" encoding="utf-8"?>
  9. <xsl:stylesheet version="1.0"
  10. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  11. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  12.  
  13. <xsl:output method="xml" indent="yes"/>
  14.  
  15. <xsl:template match="@* | node()">
  16. <xsl:apply-templates select="xml"></xsl:apply-templates>
  17. </xsl:template>
  18.  
  19. <xsl:template match="xml">
  20. <xsl:element name="exercises">
  21. <xsl:attribute name="xsi:noNamespaceSchemaLocation">mySchema.xsd</xsl:attribute>
  22. some value
  23. </xsl:element>
  24. </xsl:template>
  25. </xsl:stylesheet>
  26.  
  27. <exercises xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="mySchema.xsd">
  28.  
  29. <xsl:stylesheet version="1.0"
  30. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. exclude-result-prefixes="xsi">
  33. <xsl:output omit-xml-declaration="yes"/>
  34. <!-- -->
  35. <xsl:template match="/">
  36. <exercises xsi:noNamespaceSchemaLocation="mySchema.xsd"/>
  37. </xsl:template>
  38. </xsl:stylesheet>
  39.  
  40. <exercises xsi:noNamespaceSchemaLocation="mySchema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
  41.  
  42. <xsl:attribute name="xsi:noNamespaceSchemaLocation">
  43. <xsl:value-of select="'mySchema.xsd'"/>
  44. </xsl:attribute>
Add Comment
Please, Sign In to add comment