<manpage id="domNode" cat="cmd" title="domNode">
  <namesection>
    <name>domNode</name>
    <desc>Manipulates an instance of a DOM node object</desc>
  </namesection>

<!--

  Copyright (c) 1999 Jochen Loewer (loewerj@hotmail.com)
  Copyright (c) 2002-2005 Rolf Ade (rolf@pointsman.de)

 See the file "LICENSE" for information on usage and redistribution
 of this file, and for a DISCLAIMER OF ALL WARRANTIES.

-->

  <synopsis>
    <syntax> $nodeObject <m>method</m>  <m>arg arg ...</m></syntax>
  </synopsis>
  <section>
    <title> DESCRIPTION </title>

    <p>This command manipulates one particular instance of a DOM node object.
<m>method</m> indicates a specific method of the node class. These methods
should closely conform to the W3C recommendation &quot;Document Object Model
(Core) Level 1&quot; (<ref
href="http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html">http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html</ref>)
as well to parts of the W3C draft &quot;XML Pointer Language (XPointer)&quot;
(<ref
href="http://www.w3.org/TR/1998/WD-xptr-19980303">http://www.w3.org/TR/1998/WD-xptr-19980303</ref>).
Please note, that the XPointer methods are deprecated. Use DOM methods
or XPath expressions instead of them.</p>

    <p>The selectNodes method implements the &quot;XML Path
Language (XPath) Version 1.0&quot; W3C recommendation 16 November 1999 (<ref
href="http://www.w3.org/TR/1999/REC-xpath-19991116">http://www.w3.org/TR/1999/REC-xpath-19991116</ref>). Look
at these documents for a deeper understanding of the functionality.</p>

    <p>The valid methods are:</p>

    <commandlist>
      <commanddef>
        <command><method>nodeType</method></command>
        <desc>Returns the node type of that node object. This can be:
ELEMENT_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE or
PROCESSING_INSTRUCTION_NODE.</desc>
      </commanddef>

      <commanddef>
        <command><method>nodeName</method></command>
        <desc>Returns the node name of that node object. This is the element
(tag) name for element nodes (type ELEMENT_NODE), the processing-instruction
target for processing-instructions, &quot;#text&quot; for text node,
&quot;#comment&quot; for comment nodes or &quot;#cdata&quot; for cdata section
nodes.</desc>
      </commanddef>

      <commanddef>
        <command><method>nodeValue</method> <m>?newValue?</m></command>
        <desc>Returns the value of that node object. This is the text or
the data for element nodes of type TEXT_NODE, COMMENT_NODE,
PROCESSING_INSTRUCTION_NODE or CDATA_SECTION_NODE). Otherwise it is empty. If
the node is a TEXT_NODE, COMMENT_NODE or PROCESSING_INSTRUCTION_NODE and the
optional argument <m>newValue</m> is given, the node is set to that
value.</desc>

      </commanddef>

      <commanddef>
        <command><method>hasChildNodes</method></command>
        <desc>Returns 1 if the node has children. Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>parentNode</method> <variable>?objVar?</variable></command>
        <desc>Returns the parent node.</desc>
      </commanddef>

      <commanddef>
        <command><method>childNodes</method></command>
        <desc>Returns a list of direct children node objects.</desc>
      </commanddef>

      <commanddef>
        <command><method>childNodesLive</method></command>
        <desc>Returns a &quot;live&quot; nodeList object of the child nodes of
the node in the sense of the DOM recommendation. This nodeList object is
&quot;live&quot; in the sense that, for instance, changes to the children of
the node object that it was created from are immediately reflected in the nodes
returned by the NodeList accessors; it is not a static snapshot of the content
of the node. The two accessors known by the nodeList object are &quot;item
&lt;index&gt;&quot;, which returns the indexth item in the collection, and
&quot;length&quot;, which returns the number of nodes in the list.</desc>
      </commanddef>

      <commanddef>
        <command><method>firstChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the first child as a node object.</desc>
      </commanddef>

      <commanddef>
        <command><method>lastChild</method> <variable>?objVar?</variable></command>
        <desc>Returns the last child as a node object.</desc>
      </commanddef>
      
      <commanddef>
        <command><method>nextSibling</method>  <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relative to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>previousSibling</method> <variable>?objVar?</variable></command>
        <desc>Returns the next sibling relative to the current node as a node
object.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementsByTagName</method> <m>name</m></command>
        <desc>Returns a list of all elements in the subtree matching (glob
style) <m>name</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementsByTagNameNS</method> <m>uri</m> <m>localname</m></command>
        <desc>Returns a list of all elements in the subtree
matching (glob style) <m>localname</m> and having the given namespace
<m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>getElementById</method> <m>id</m></command>
        <desc>Returns the node having an id attribute with value
<m>id</m> or the empty string if no node has an id attribute with that value.</desc>
      </commanddef>

      <commanddef>
        <command><method>hasAttribute</method> <m>attributeName</m></command>
        <desc>Returns 1 if the object node contains an attribute with name
<m>attributeName</m> . Otherwise 0 is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>getAttribute</method> <m>attributeName  ?defaultValue?</m></command>
        <desc>Returns the value of the attribute <m>attributeName</m>. If the
attribute is not available <m>defaultValue</m> is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>setAttribute</method> <m>attributeName newValue 
?attributeName newValue ...?</m></command>
        <desc>Sets the value for one or more attributes. Every
        <m>attributeName</m> is set to the corresponding
        <m>newValue</m>. If there isn't an attribute for one or more
        of the <m>attributeName</m>, this will create that attribute.
        It is not recommended to set attributes that look like XML
        namespace declarations.</desc>
      </commanddef>

      <commanddef>
        <command><method>removeAttribute</method> <m>attributeName</m></command>
        <desc>Removes the attribute <m>attributeName</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>hasAttributeNS</method> <m>uri</m> <m>localName</m></command>
        <desc>Returns 1 if the object node contains an attribute with the
local name <m>localName</m> within the namespace <m>uri</m>.  Otherwise 0 is
returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>getAttributeNS</method> <m>uri</m> <m>localName
?defaultValue?</m></command>
        <desc>Returns the value of the attribute with the local name
<m>localName</m> within the namespace URI <m>uri</m>. If the node dosn't have
that attribute the <m>defaultValue</m> is returned.</desc>
      </commanddef>

      <commanddef>
        <command><method>setAttributeNS</method> <m>uri qualifiedName newValue
?uri qualifiedName newValue ...?</m> </command>
        <desc><p>Sets the value for one or more full qualified
attributes. Every attribute <m>qualifiedName</m> with the namespace URI
<m>uri</m> will be set to <m>newValue</m>. This will create a new attribute, if
it wasn't available before. If you want to set an attribute within a namespace
you must specify the attribute name with prefix, even if you want to set an
already existing attribute to a new value. While searching, if the attribute
already exists, only the given <m>uri</m> and the localname of the
<m>qualifiedName</m> is used.</p>

        <example>$node setAttributeNS "http://some.uri.com/wow" prefix:attr1 attrValue</example>

<p>If the uri is the empty string and the attribute name has no
prefix, this method has the same effect as the method
<b>setAttribute</b>.</p>

        <example>$node setAttributeNS "" attri "some Value"</example>

<p>With the exceptions of the special prefixes "xmlns" and "xml" you
always must provide a non empty <m>uri</m> if your <m>qualifiedName</m> has a
prefix. It is not recommended to set XML namespace declarations. The effects are complicated and not always obvious up to resulting a not well-formed serializations after further processing.</p></desc>
      </commanddef>

      <commanddef>
        <command><method>removeAttributeNS</method> <m>uri</m> <m>localName</m></command>
        <desc>Removes the attribute with the local name <m>localName</m> within
 the namespace <m>uri</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>attributes</method> <option>?attributeNamePattern?</option></command>
        <desc>Returns information about the attributes matching the
        <m>attributeNamePattern</m>. If <m>attributeNamePattern</m>
        isn't given, information about all attributes are returned.
        The return value is a Tcl list, the elements just the
        attribute name in case of non namespaced attributes and three
        element sublists for namespaced attributes. In case of an
        "ordinary" namespaced attribute, the sublist elements are
        {&lt;localname&gt; &lt;prefix&gt; &lt;namespace_uri&gt;}. In the special case of
        an XML namespace declaration it is {&lt;the prefix defined&gt;
        &lt;localname&gt; ""}.
        </desc>
      </commanddef>

      <commanddef>
        <command><method>attributeNames</method> <option>?attributeNamePattern?</option></command>
        <desc>Returns a flat list of all attributes names (as found in
        the XML source) matching the <m>attributeNamePattern</m>. If
        <m>attributeNamePattern</m> isn't given, all attribute names
        are returned as a Tcl list.</desc>
      </commanddef>
      
      <commanddef>
        <command><method>appendChild</method> <m>newChild</m></command>
        <desc>Appends <m>newChild</m> to the end of the child list of the
node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBefore</method> <m>newChild</m>  <m>refChild</m></command>
        <desc>Inserts <m>newChild</m> before the <m>refChild</m> into the list of
children of node. If <m>refChild</m> is the empty string, insert
<m>newChild</m> at the end of the child nodes list of that node.</desc>
      </commanddef>

      <commanddef>
        <command><method>replaceChild</method> <m>newChild</m>  <m>oldChild</m></command>
        <desc>Replaces <m>oldChild</m> with <m>newChild</m> in the list of
children of that node. The <m>oldChild</m> node will be part of the
document fragment list after this operation.</desc>
      </commanddef>

      <commanddef>
        <command><method>removeChild</method> <m>child</m></command>
        <desc>Removes <m>child</m> from the list of children of that node.
<m>child</m> will be part of the document fragment list after this
operation.</desc>
      </commanddef>

      <commanddef>
        <command><method>delete</method></command>
        <desc>Deletes the given node and its complete child tree
and frees the complete internal memory. The affected nodes are not accessible
through the document fragment list.</desc>
      </commanddef>

      <commanddef>
        <command><method>cloneNode</method> <option>?-deep?</option></command>
        <desc>Clones this node and adds the new create node into the document
fragment list. If the <m>-deep</m> option is specified, all descendant nodes
are also cloned.</desc>
      </commanddef>

      <commanddef>
        <command><method>ownerDocument</method> <variable>?domObjVar?</variable></command>
        <desc>Returns the document object of the document this node belongs
to.</desc>
      </commanddef>

      <commanddef>
        <command><method>find</method> <m>attrName</m> <m>attrVal</m>
<option>?objVar?</option></command>
        <desc>Finds the node with the attribute name <m>attrName</m>, and
attribute value <m>attrVal</m> in the subtree starting the current node.</desc>
      </commanddef>

      <commanddef>
        <command><method>child</method> <m>number|all</m> <option>type</option>
<option>attrName attrValue</option></command>
        <desc>(XPointer) child</desc>
      </commanddef>
      
      <commanddef>
        <command><method>descendant</method> <m>number|all</m> <option>type</option>
<option>attrName attrValue</option></command>
        <desc>(XPointer) descendant</desc>
      </commanddef>

      <commanddef>
        <command><method>ancestor</method> <m>number|all</m> <option>type</option>
<option>attrName attrValue</option></command>
        <desc>(XPointer) ancestor</desc>
      </commanddef>

      <commanddef>
        <command><method>fsibling</method> <m>number|all</m> <option>type</option>
<option>attrName attrValue</option></command>
        <desc>(XPointer) fsibling</desc>
      </commanddef>

      <commanddef>
        <command><method>psibling</method> <m>number|all</m> <option>type</option>
<option>attrName attrValue</option></command>
        <desc>(XPointer) psibling</desc>
      </commanddef>

      <commanddef>
        <command><method>root</method>  <option>objVar</option></command>
        <desc>(XPointer) root</desc>
      </commanddef>

      <commanddef>
        <command><method>text</method></command>
        <desc>Returns all text node children of that current node combined,
i.e. appended into one string.</desc>
      </commanddef>

      <commanddef>
        <command><method>target</method></command>
        <desc>For a processing instruction node the target part is returned.
Otherwise an error is generated.</desc>
      </commanddef>

      <commanddef>
        <command><method>data</method></command>
        <desc>For a processing instruction node the data part is returned. For
a text node, comment node or cdata section node the value is returned.
Otherwise an error is generated.</desc>
      </commanddef>

      <commanddef>
        <command><method>prefix</method></command>
        <desc>Returns the namespace prefix.</desc>
      </commanddef>

      <commanddef>
        <command><method>namespaceURI</method></command>
        <desc>Returns the namespace URI.</desc>
      </commanddef>

      <commanddef>
        <command><method>localName</method></command>
        <desc>Returns the localName from the tag name of the given node.</desc>
      </commanddef>

      <commanddef>
          <command><method>selectNodes</method> <option>?-namespaces prefixUriList?</option> <option>?-cache &lt;boolean&gt;?</option> <option>?-list?</option> <m>xpathQuery</m> <option>?typeVar?</option></command>
          <desc><p>Returns the result of applying the XPath query
<m>xpathQuery</m> to the subtree. This result can be a
string/value, a list of strings, a list of nodes or a list
of attribute name / value pairs. If <m>typeVar</m> argument is given
the result type name is stored into that variable (empty,
bool, number, string, nodes, attrnodes or mixed).</p>

<p>The argument <m>xpathQuery</m> has to be a valid XPath 1.0 expression.
However there are a few exceptions to that rule. Tcl variable
references (in the usual tcl syntax: $varname) may appear in the XPath
statement at any position where it is legal according to the rules of
the XPath syntax to put an XPath variable. Ignoring the syntax rules of
XPath the Tcl variable name may be any legal Tcl var name: local
variables, global variables, array entries and so on. The value will
always be seen as string literal by the xpath engine. Cast the value
explicitly with the according xpath functions (number(), boolean()) to
another data type, if needed.</p>

<p>Similar to the way described above to inject literals in a secure
way into the XPath expression using tcl variable references there is a
syntax to inject element names from tcl variables. At every place
where the XPath syntax allows a node test there could be a Tcl
variable reference (in any form), just the leading $ replaced with %.
This allows one to select nodes with 'strange' (invalid, according to the
appropriate XML production rule) node names which may be needed in
case of working with JSON data.</p>

<p>The option <m>-namespaces</m> expects a Tcl list with prefix /
namespace pairs as argument. If this option is not given, then any
namespace prefix within the xpath expression will be first resolved
against the list of prefix / namespace pairs set with the
selectNodesNamespaces method for the document, the node belongs to. If
this fails, then the namespace definitions in scope of the context
node will be used to resolve the prefix. If this option is given, any
namespace prefix within the xpath expression will be first resolved
against that given list (and ignoring the document global prefix /
namespace list). If the list binds the same prefix to different
namespaces, then the first binding will win.  If this fails, then the
namespace definitions in scope of the context node will be used to
resolve the prefix, as usual.</p>

<p>If the <m>-cache</m> option is used with a true value, then the
<m>xpathQuery</m> will be looked up in a document specific cache. If
the query is found, then the stored pre-compiled query will be used.
If the query isn't found, it will be compiled and stored in the cache,
for use in further calls. Please note that the <m>xpathQuery</m> 
given as string is used as key for the cache. This means, that equal
XPath expressions, which differ only in white space are treated as
different cache entries. Special care is needed, if the XPath
expression includes namespace prefixes or references to Tcl variables.
Both namespace prefixes and Tcl variable references will be resolved
according to the XML prefix namespace mappings and Tcl variable values
at expression compilation time. If the same XPath expression is used
later on in a context with other XML prefix namespace mappings or
values of the used Tcl variables, make sure to first remove the
compiled expression from the cache with the help of the
<method>deleteXPathCache</method> method, to force a recompilation.
Without using the <m>-cache</m> option such consideration is never
needed.</p>

<p>If the <m>-list</m> option is given then the <m>xpathQuery</m>
argument is expected to be a Tcl list of XPath queries. Every XPath
query in this list other than the last one must return a node set
result. Using the context and namespace resolution rules as without
the <m>-list</m> option the first query out of the list is run. Every
node out of the result set of this query is used as context node for
the next XPath query out of the list and so on. It returns the result
sets of the last query in the query list concatenated together.</p>

<p>Examples:</p>
          <example>set paragraphNodes [$node selectNodes {chapter[3]//para[@type='warning' or @type='error'} ]
foreach paragraph $paragraphNodes {
    lappend  values [$paragraph selectNodes attribute::type]
}

set doc [dom parse {&lt;doc xmlns="http://www.defaultnamespace.org"&gt;&lt;child/&gt;&lt;/doc&gt;}]
set root [$doc documentElement]
set childNodes [$root selectNodes -namespaces {default http://www.defaultnamespace.org} default:child]</example>

          </desc>
      </commanddef>

      <commanddef>
        <command><method>getLine</method></command>
        <desc>Returns the line number of that node in the originally
        parsed XML. The counting starts with 1</desc>
      </commanddef>
      
      <commanddef>
        <command><method>getColumn</method></command>
        <desc>Returns the column number of that node in the originally
        parsed XML. The counting starts with 0</desc>
      </commanddef>

      <commanddef>
        <command><method>getByteIndex</method></command>
        <desc>Returns the byte position of that node in the originally
        parsed XML. The counting starts with 0.</desc>
      </commanddef>

      <commanddef>
        <command><method>asList</method></command>
        <desc>Returns the DOM substree starting from the current node as a
nested Tcl list.</desc>
      </commanddef>

      <commanddef>
        <command><method>asXML</method> <option>?-indent none/tabs/1..8?</option> <option>?-channel channelId?</option> <option>?-escapeNonASCII?</option> <option>?-doctypeDeclaration &lt;boolean&gt;?</option> <option>-xmlDeclaration &lt;boolean&gt;?</option> <option>-encString &lt;string&gt;</option> <option>?-escapeAllQuot?</option> <option>?-indentAttrs?</option> <option>?-nogtescape?</option> <option>?-noEmptyElementTag?</option> <option>?-escapeCR?</option> <option>?-escapeTab?</option></command>
        <desc><p>Returns the DOM substree starting from the current
        node as the root node of the result as an (optional indented)
        XML string or sends the output directly to the given
        channelId.</p>

        <p>See the documentation of the
        <command>domDoc</command> command method
        <method>asXML</method> for a detailed description of the
        arguments.</p>
        </desc>
      </commanddef>

      <commanddef>
        <command><method>asCanonicalXML</method> <option>?-channel channelId?</option> <option>?-comment?</option></command>
        <desc><p>Returns the DOM tree as canonical XML string
        according to the "<ref
        href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">Canonical
        XML Version 1.0 W3C Recommendation 15 March 2001</ref>" or
        sends the output directly to the given channelId.</p>

        <p>See the documentation of the
        <command>domDoc</command> command method
        <method>asCanonicalXML</method> for a detailed description of the
        arguments.</p>
        </desc>
      </commanddef>
      
      <commanddef>
        <command><method>asHTML</method> <option>?-channel
channelId?</option> <option>b?-escapeNonASCII?</option> <option>?-htmlEntities?</option> <option>?-doctypeDeclaration &lt;boolean&gt;?</option> <option>?-breakLines?</option> <option>?-onlyContents?</option></command>
        <desc><p>Returns the DOM substree starting from the current
        node as the root node of the result serialized according to
        HTML rules (HTML elements are recognized regardless of case,
        without end tags for empty HTML elements etc.), as string or
        sends the output directly to the given channelId.</p>

        <p>See the documentation of the <command>domDoc</command>
        method <method>asHTML</method> for a detailed description of
        the arguments.</p>
        </desc>
      </commanddef>

      <commanddef>
        <command><method>asText</method></command>
          <desc>For ELEMENT_NODEs, the asText method outputs 
the string-value of every text node descendant of node in document
order without any escaping. For every other node type, this method outputs the XPath string value of that node.</desc>
      </commanddef>

      <commanddef>
        <command><method>asJSON</method> <option>?-indent none/0..8?</option> <option>?-channel channelId?</option></command>
          <desc><p>The asJSON method serializes the subtree starting with the node the method was called on into a valid
          JSON data string.</p>
          
          <p>See the documentation of the <command>domDoc</command>
          method <method>asJSON</method> for a detailed description of
          the method</p>
          </desc>
      </commanddef>

      <commanddef>
        <command><method>asTclValue</method> <option>?typevariable?</option></command>
        <desc><p>In case the subtree starting with the node the method
        was called on includes JSON type information this method
        returns the JSON data as nested Tcl data structure.</p>
        <p>See the documentation of the <command>domDoc</command>
        method <method>asTclValue</method> for a detailed description of
        the method</p>
        </desc>
      </commanddef>
      
      <commanddef>
        <command><method>appendFromList</method> <m>list</m></command>
        <desc>Parses <m>list</m> , creates an according DOM subtree and
appends this subtree to the current node.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendFromScript</method> <m>tclScript</m></command>
        <desc>Appends the nodes created in the <m>tclScript</m> by
Tcl functions, which have been built using <m>dom createNodeCmd</m>, to the
given node.</desc>
      </commanddef>

      <commanddef>
        <command><method>insertBeforeFromScript</method> <m>tclScript</m> <m>refChild</m></command>
        <desc>Inserts the nodes created in the <m>tclScript</m> by
Tcl functions, which have been built using <m>dom createNodeCmd</m>, before the
<m>refChild</m> into the list of children of node. If <m>refChild</m> is
the empty string, the new nodes will be appended.</desc>
      </commanddef>

      <commanddef>
        <command><method>appendXML</method> <m>XMLstring</m></command>
        <desc>Parses <m>XMLstring</m>, creates an according DOM subtree and
appends this subtree to the current node.</desc>
      </commanddef>

      <commanddef>
        <command><method>simpleTranslate</method> <m>outputVar</m>
<m>specifications</m></command>
        <desc>Translates the subtree starting at the object node according to
the specifications in <m>specifications</m> and outputs the result in the
variable <m>outputVar</m> . The translation is very similar to Cost Simple
mode.</desc>
      </commanddef>

      <commanddef>
        <command><method>toXPath</method> <m>?-legacy?</m></command>
        <desc>Returns an XPath, which exactly addresses the given
node in its document. This XPath is only valid as there are no changes to DOM
tree made later one. With the -legacy option, other XPath expressions
are returned, which doesn't work in all cases.</desc>
      </commanddef>

      <commanddef>
        <command><method>getBaseURI</method></command>
        <desc>Returns the baseURI of the node. This method is deprecated in
          favor of the <m>baseURI</m> method.</desc>
      </commanddef>

      <commanddef>
        <command><method>baseURI</method> <m>?URI?</m></command>
        <desc>Returns the present baseURI of the node. If the optional 
argument URI is given, it sets the base URI of the node and of all of its child
nodes out of the same entity as node to the given URI.</desc>
      </commanddef>

      <commanddef>
        <command><method>disableOutputEscaping</method> <m>?boolean?</m></command>
        <desc>This method works only for text nodes; for every other node it
returns error. Without the optional argument it returns, if disabling output
escaping is on. The return value 0 means, the characters of the text node will
be escaped, to generate valid XML, if serialized. This is the default for
every parsed or created text node (with the exception of that text nodes in a
result tree of an XSLT transformation, for which disabling output escaping was
requested explicitly in the stylesheet). The return value 1 means, that output
escaping is disabled for this text node. If such a text node is serialized
(with asXML or asHTML), it is literally written, without escaping of the
special XML characters. If the optional boolean value <m>boolean</m> is given,
the flag is set accordingly. You should not set this flag to 1 until you
really know what you do.</desc>
      </commanddef>

      <commanddef>
        <command><method>precedes</method> <m>refnode</m></command>
        <desc>Compares the relative order of the node and <m>refnode</m>. Both
nodes must be part of the same documents and not out of the fragment list of
the document. Returns true if node is in document order (in the sense of the
XPath 1.0 recommendation) before <m>refnode</m>, and false otherwise.</desc>
      </commanddef>


      <commanddef>
        <command><method>normalize</method> <m>?-forXPath?</m></command>
        <desc>Puts all Text nodes in the full depth of the sub-tree underneath
this Node into a "normal" form where only structure (e.g., elements,
comments, processing instructions and CDATA
sections) separates Text nodes, i.e., there
are neither adjacent Text nodes nor empty Text nodes. If the option
<m>-forXPath</m> is given, all CDATA sections in the nodes are
converted to text nodes, as a first step before the
normalization. </desc>
      </commanddef>

      <commanddef>
        <command><method>xslt</method> <option>?-parameters
parameterList?</option> <option>?-ignoreUndeclaredParameters?</option>
<option>?-maxApplyDepth int?</option>
<option>?-xsltmessagecmd script?</option> <m>stylesheet</m> <m>?outputVar?</m></command>
        <desc>Applies an XSLT transformation on the document using the XSLT
<m>stylesheet</m> (given as domDoc). Returns a document object containing the
result document of that transformation and stores it in the optional
<m>outputVar</m>. 

<p>The optional <m>-parameters</m> option sets top level
&lt;xsl:param&gt; to string values. The <m>parameterList</m> has to be a Tcl
list consisting of parameter name and value pairs.</p>

<p>If the option <m>-ignoreUndeclaredParameters</m> is given, then parameter
names in the <m>parameterList</m> given to the <m>-parameters</m> options that
are not declared as top-level parameters in the stylesheet are silently
ignored. Without this option, an error is raised if the user tries to set a
top-level parameter which is not declared in the stylesheet.</p>

<p>The option <m>-maxApplyDepth</m> expects a positive integer as
argument. By default, the XSLT engine allows XSLT templates to nest up
to 3000 levels (and raises error if they nest deeper). This limit can
be set by the <m>-maxApplyDepth</m> option.</p>

<p>The <m>-xsltmessagecmd</m> option sets a callback for xslt:message elements
in the stylesheet. The actual command consists of the script, given as argument
to the option, appended with the XML Fragment from instantiating the
xsl:message element content as string (as if the XPath string() function would
have been applied to the XML Fragment) and a flag, which indicates whether the
xsl:message has an attribute "terminate" with the value "yes". If the
called script returns anything else then TCL_OK then the XSLT
transformation will be aborted, returning error. If the called script
returns -code break the error message is empty, otherwise the result
code is reported. In case of terminated transformation the outputVar,
if given, is set to the empty string.</p>
</desc>
      </commanddef>

      <commanddef>
        <command><m>@attrName</m></command>
        <desc>Returns the value of the attribute <m>attrName</m>.  Short cut
for <m>getAttribute</m>.</desc>
      </commanddef>

      <commanddef>
        <command><method>jsonType</method> <m>?(OBJECT|ARRAY|NONE)|(STRING|NUMBER|TRUE|FALSE|NULL|NONE)?</m></command>
        <desc>Only element and text nodes may have a JSON type and
        only this types of nodes support the <m>jsonType</m> method;
        the other node types return error if called with this method.
        Returns the jsonType of the node. If the optional argument is
        given, the JSON type of the node is set to the given type and
        returned. Valid type arguments for element nodes are OBJECT,
        ARRAY and NONE. Valid type arguments for text nodes are
        STRING, NUMBER, TRUE, FALSE, NULL and NONE.</desc>
      </commanddef>

    </commandlist>

    
    <p>Otherwise, if an unknown method name is given, the command with the same
name as the given method within the namespace <l>::dom::domNode</l> is tried to
be executed. This allows quick method additions on Tcl level.</p>

  </section>


  <seealso>
    <ref>dom</ref>
    <ref>domDoc</ref>
  </seealso>
  
  <keywords>
    <keyword>XML</keyword>
    <keyword>XPath</keyword>
    <keyword>DOM</keyword>
    <keyword>document</keyword>
    <keyword>node</keyword>
    <keyword>parsing</keyword>
  </keywords>
  
</manpage>

