[XML4Lib] xpath expression
Eric Lease Morgan
emorgan at nd.edu
Fri Sep 21 11:35:29 EDT 2007
Can somebody here please tell me a secret XPath expression --
incantation -- I can use to list all of the elements matching c01 -
c12 in the following XML snippet:
<ead>
<eadheader />
<archdesc>
<dsc>
<!-- insert any number of c or c01 elements here, but not both
-->
<c01>
<!-- insert any number of c02 elements here -->
<p>co1</p>
<c02>
<!-- insert any number of c03 elements here -->
<p>co2</p>
<c03>
<!-- insert any number of c04 through c12 elements here -->
<p>co3a</p>
</c03>
<c03>
<p>co3b</p>
</c03>
<c03>
<p>co3c</p>
</c03>
</c02>
</c01>
</dsc>
</archdesc>
</ead>
The XML snippet above represents an EAD file. Each EAD file can
contain any number of "components" denoted by elements c or c01
through c12. Each of these components are often times folders in gray
boxes on archive shelves.
I want to get a list of all these components, read their child data,
and index it. I suppose I could something like this:
<xsl:for-each select='//c01'>
</xsl:for-each>
and the repeat it for all the other elements (c02 through c12, plus
c), but that doesn't seem very efficient. There is probably a better
way. Something list does not compile:
<xsl:for-each select='//c*'>
--
Eric "Needs A Better XPath Reference Book" Morgan
More information about the XML4Lib
mailing list