<html xml:space="preserve"> <head> <title>Top-level elements displayed</title> <script language="JavaScript"> <!-- var e0 = '<xsl:output omit-xml-declaration="yes" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e1 = '<xsl:param name="use-empty-syntax" select="true()" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e2 = '<xsl:param name="exclude-unused-prefixes" select="true()" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e3 = '<xsl:param name="start-tag-start" select="\'<\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e4 = '<xsl:param name="start-tag-end" select="\'>\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e5 = '<xsl:param name="empty-tag-end" select="\'/>\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e6 = '<xsl:param name="end-tag-start" select="\'</\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e7 = '<xsl:param name="end-tag-end" select="\'>\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e8 = '<xsl:param name="space" select="\' \'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e9 = '<xsl:param name="ns-decl" select="\'xmlns\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e10 = '<xsl:param name="colon" select="\':\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e11 = '<xsl:param name="equals" select="\'=\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e12 = '<xsl:param name="attribute-delimiter" select="\'"\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e13 = '<xsl:param name="comment-start" select="\'<!-' + '-\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e14 = '<xsl:param name="comment-end" select="\'-' + '->\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e15 = '<xsl:param name="pi-start" select="\'<?\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e16 = '<xsl:param name="pi-end" select="\'?>\'" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/>'; var e17 = '<xsl:template name="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="node-set" select="."/>\n <xsl:apply-templates select="$node-set" mode="xml-to-string">\n <xsl:with-param name="depth" select="1"/>\n </xsl:apply-templates>\n </xsl:template>'; var e18 = '<xsl:template match="/" name="xml-to-string-root-rule" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:call-template name="xml-to-string"/>\n </xsl:template>'; var e19 = '<xsl:template match="/" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="depth"/>\n <xsl:apply-templates mode="xml-to-string">\n <xsl:with-param name="depth" select="$depth"/>\n </xsl:apply-templates>\n </xsl:template>'; var e20 = '<xsl:template match="*" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="depth"/>\n <xsl:variable name="element" select="."/>\n <xsl:value-of select="$start-tag-start"/>\n <xsl:call-template name="element-name">\n <xsl:with-param name="text" select="name()"/>\n </xsl:call-template>\n <xsl:apply-templates select="@*" mode="xml-to-string"/>\n <xsl:for-each select="namespace::*">\n <xsl:call-template name="process-namespace-node">\n <xsl:with-param name="element" select="$element"/>\n <xsl:with-param name="depth" select="$depth"/>\n </xsl:call-template>\n </xsl:for-each>\n <xsl:choose>\n <xsl:when test="node() or not($use-empty-syntax)">\n <xsl:value-of select="$start-tag-end"/>\n <xsl:apply-templates mode="xml-to-string">\n <xsl:with-param name="depth" select="$depth + 1"/>\n </xsl:apply-templates>\n <xsl:value-of select="$end-tag-start"/>\n <xsl:call-template name="element-name">\n <xsl:with-param name="text" select="name()"/>\n </xsl:call-template>\n <xsl:value-of select="$end-tag-end"/>\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$empty-tag-end"/>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>'; var e21 = '<xsl:template name="process-namespace-node" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="element"/>\n <xsl:param name="depth"/>\n <xsl:variable name="declaredAbove">\n <xsl:call-template name="isDeclaredAbove">\n <xsl:with-param name="depth" select="$depth - 1"/>\n <xsl:with-param name="element" select="$element/.."/>\n </xsl:call-template>\n </xsl:variable>\n <xsl:if test="(not($exclude-unused-prefixes) or ($element | $element//@* | $element//*)[namespace-uri()=current()]) and not(string($declaredAbove)) and name()!=\'xml\'">\n <xsl:value-of select="$space"/>\n <xsl:value-of select="$ns-decl"/>\n <xsl:if test="name()">\n <xsl:value-of select="$colon"/>\n <xsl:call-template name="ns-prefix">\n <xsl:with-param name="text" select="name()"/>\n </xsl:call-template>\n </xsl:if>\n <xsl:value-of select="$equals"/>\n <xsl:value-of select="$attribute-delimiter"/>\n <xsl:call-template name="ns-uri">\n <xsl:with-param name="text" select="string(.)"/>\n </xsl:call-template>\n <xsl:value-of select="$attribute-delimiter"/>\n </xsl:if>\n </xsl:template>'; var e22 = '<xsl:template name="isDeclaredAbove" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="element"/>\n <xsl:param name="depth"/>\n <xsl:if test="$depth > 0">\n <xsl:choose>\n <xsl:when test="$element/namespace::*[name(.)=name(current()) and .=current()]">1</xsl:when>\n <xsl:when test="$element/namespace::*[name(.)=name(current())]"/>\n <xsl:otherwise>\n <xsl:call-template name="isDeclaredAbove">\n <xsl:with-param name="depth" select="$depth - 1"/>\n <xsl:with-param name="element" select="$element/.."/>\n </xsl:call-template>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:if>\n </xsl:template>'; var e23 = '<xsl:template match="@*" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:value-of select="$space"/>\n <xsl:call-template name="attribute-name">\n <xsl:with-param name="text" select="name()"/>\n </xsl:call-template>\n <xsl:value-of select="$equals"/>\n <xsl:value-of select="$attribute-delimiter"/>\n <xsl:call-template name="attribute-value">\n <xsl:with-param name="text" select="string(.)"/>\n </xsl:call-template>\n <xsl:value-of select="$attribute-delimiter"/>\n </xsl:template>'; var e24 = '<xsl:template match="comment()" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:value-of select="$comment-start"/>\n <xsl:call-template name="comment-text">\n <xsl:with-param name="text" select="string(.)"/>\n </xsl:call-template>\n <xsl:value-of select="$comment-end"/>\n </xsl:template>'; var e25 = '<xsl:template match="processing-instruction()" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:value-of select="$pi-start"/>\n <xsl:call-template name="pi-target">\n <xsl:with-param name="text" select="name()"/>\n </xsl:call-template>\n <xsl:value-of select="$space"/>\n <xsl:call-template name="pi-text">\n <xsl:with-param name="text" select="string(.)"/>\n </xsl:call-template>\n <xsl:value-of select="$pi-end"/>\n </xsl:template>'; var e26 = '<xsl:template match="text()" mode="xml-to-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:call-template name="text-content">\n <xsl:with-param name="text" select="string(.)"/>\n </xsl:call-template>\n </xsl:template>'; var e27 = '<xsl:template name="element-name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e28 = '<xsl:template name="attribute-name" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e29 = '<xsl:template name="attribute-value" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:variable name="escaped-markup">\n <xsl:call-template name="escape-markup-characters">\n <xsl:with-param name="text" select="$text"/>\n </xsl:call-template>\n </xsl:variable>\n <xsl:choose>\n <xsl:when test="$attribute-delimiter = "\'"">\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$escaped-markup"/>\n <xsl:with-param name="replace" select=""\'""/>\n <xsl:with-param name="with" select="\'&apos;\'"/>\n </xsl:call-template>\n </xsl:when>\n <xsl:when test="$attribute-delimiter = \'"\'">\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$escaped-markup"/>\n <xsl:with-param name="replace" select="\'"\'"/>\n <xsl:with-param name="with" select="\'&quot;\'"/>\n </xsl:call-template>\n </xsl:when>\n <xsl:otherwise>\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$escaped-markup"/>\n <xsl:with-param name="replace" select="$attribute-delimiter"/>\n <xsl:with-param name="with" select="\'\'"/>\n </xsl:call-template>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>'; var e30 = '<xsl:template name="ns-prefix" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e31 = '<xsl:template name="ns-uri" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:call-template name="attribute-value">\n <xsl:with-param name="text" select="$text"/>\n </xsl:call-template>\n </xsl:template>'; var e32 = '<xsl:template name="text-content" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:call-template name="escape-markup-characters">\n <xsl:with-param name="text" select="$text"/>\n </xsl:call-template>\n </xsl:template>'; var e33 = '<xsl:template name="pi-target" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e34 = '<xsl:template name="pi-text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e35 = '<xsl:template name="comment-text" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:value-of select="$text"/>\n </xsl:template>'; var e36 = '<xsl:template name="escape-markup-characters" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:variable name="ampEscaped">\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$text"/>\n <xsl:with-param name="replace" select="\'&\'"/>\n <xsl:with-param name="with" select="\'&amp;\'"/>\n </xsl:call-template>\n </xsl:variable>\n <xsl:variable name="ltEscaped">\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$ampEscaped"/>\n <xsl:with-param name="replace" select="\'<\'"/>\n <xsl:with-param name="with" select="\'&lt;\'"/>\n </xsl:call-template>\n </xsl:variable>\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="$ltEscaped"/>\n <xsl:with-param name="replace" select="\']]>\'"/>\n <xsl:with-param name="with" select="\']]&gt;\'"/>\n </xsl:call-template>\n </xsl:template>'; var e37 = '<xsl:template name="replace-string" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n <xsl:param name="text"/>\n <xsl:param name="replace"/>\n <xsl:param name="with"/>\n <xsl:variable name="stringText" select="string($text)"/>\n <xsl:choose>\n <xsl:when test="contains($stringText,$replace)">\n <xsl:value-of select="substring-before($stringText,$replace)"/>\n <xsl:value-of select="$with"/>\n <xsl:call-template name="replace-string">\n <xsl:with-param name="text" select="substring-after($stringText,$replace)"/>\n <xsl:with-param name="replace" select="$replace"/>\n <xsl:with-param name="with" select="$with"/>\n </xsl:call-template>\n </xsl:when>\n <xsl:otherwise>\n <xsl:value-of select="$stringText"/>\n </xsl:otherwise>\n </xsl:choose>\n </xsl:template>'; // --> </script> </head> <body> <h2>Top-level elements, each as a stand-alone XML document</h2> <form name="myForm"> <textarea name="xml" cols="75" rows="18"/> <br/> <select name="choice" onchange="on_change();"> <option>1. xsl:output</option><option>2. xsl:param</option><option>3. xsl:param</option><option>4. xsl:param</option><option>5. xsl:param</option><option>6. xsl:param</option><option>7. xsl:param</option><option>8. xsl:param</option><option>9. xsl:param</option><option>10. xsl:param</option><option>11. xsl:param</option><option>12. xsl:param</option><option>13. xsl:param</option><option>14. xsl:param</option><option>15. xsl:param</option><option>16. xsl:param</option><option>17. xsl:param</option><option>18. xsl:template</option><option>19. xsl:template</option><option>20. xsl:template</option><option>21. xsl:template</option><option>22. xsl:template</option><option>23. xsl:template</option><option>24. xsl:template</option><option>25. xsl:template</option><option>26. xsl:template</option><option>27. xsl:template</option><option>28. xsl:template</option><option>29. xsl:template</option><option>30. xsl:template</option><option>31. xsl:template</option><option>32. xsl:template</option><option>33. xsl:template</option><option>34. xsl:template</option><option>35. xsl:template</option><option>36. xsl:template</option><option>37. xsl:template</option><option>38. xsl:template</option> </select> </form> <script language="JavaScript"> <!-- function on_change() { document.myForm.xml.value = eval('e' + document.myForm.choice.selectedIndex); } if (document.myForm.xml.value == "") on_change(); // --> </script> </body> </html>