xsl-list
[Top] [All Lists]

Listing all element/attributes/attribute values

2005-07-07 05:58:36
Hi there,

Since someone has probably already done this and I don't want to
reinvent the wheel, I thought I'd ask here.

What I want to do is with any well-formed XML document list all the
elements, attributes and attribute-values in a sorted list.

So given something like:

<div class="foo"><p xml:id="abc123" style="font-weight: bold"
class="big">foo</p>
<span class="foo"><a
href="http://www.example.com/";>foo</a></span><span
class="bar">bar</span> <p class="small">small</p></div>

I might get output like:

a (1)
      - href
           = http://www.example.com/
div (1)
      - class
           = foo
p (2)
     - class
          = big
          = small
     - style
           = font-weight: bold
     - xml:id
           = abc123
span (2)
     - class
          = foo
          = bar

(Or I suppose an adhoc interim xml format that I could easily convert
to that would be better.)


Is this even easier in xslt2?

Many thanks for any suggestions,

-James
-- 
James Cummings, Cummings dot James at GMail dot com

--~------------------------------------------------------------------
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>