Returns the value of an attribute of a node element. If the attribute is not defined, returns null. The node can be passed as argument or attribute.
 

1 dom.element.getAttribute

<dom.element.getAttribute
    name='name'
    attr='attr'
>
    <node /> ?
</dom.element.getAttribute>
Example

Get the value of the attribute of an element.

Copy
<xsql-script name='dom_element_getAttribute'>
    <body>
        <set name='root'>
            <dom.parse><file name='c:\tmp\data.xml' type='absolute' /></dom.parse>
        </set>

        <!-- It is located in the node text which contains the text hello -->
        <set name='elem_text'>
            <dom.element.getFirstChildElement><root /></dom.element.getFirstChildElement>
        </set>

        <!-- Returns: true -->
        <println>
            <dom.element.getAttribute attr='colorize'>
                <elem_text/>
            </dom.element.getAttribute>
        </println>

        <!-- Returns : text -->
        <println>
            <dom.element.getAttribute attr='type'>
                <elem_text/>
            </dom.element.getAttribute>
        </println>

    </body>
</xsql-script>