xsl-list
[Top] [All Lists]

Re: Print all root node attributes

2005-05-29 12:06:42
Frequent Fliers wrote:
Hi i use the following snippet to print the root node name, but im also trying to retrieve all the associated attributes of the root node, if any.

Well, you can't do this, because the root node of an XML tree
doesn't have a name nor attributes. You mean the document element,
also often called root element (but *never* root node, unless
you want to confuse people).

<xsl:for-each select="*">
  <xsl:value-of select="name()" />
      <xsl:for-each select="@*">
         <xsl:value-of select="current()" />

The current() function returns the node matched by the template.
Try
 <xsl:value-of select="." />
instead.

J.Pietschmann

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>