[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Table of contents - for-each question

Subject: Re: Table of contents - for-each question
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 26 Jan 2006 11:13:15 -0500
Re:  Table of contents - for-each question
Hi,

Catching up,

At 11:34 AM 1/24/2006, llobash@xxxxxxxx wrote:
I am attempting to create a table of contents to include all elements with
<head> tag + all (c01) elements with "series" attribute and (c02 or c03)
elements with "subseries" attributes. c0x tags from Encoded Archival
Description standards, probably not important. Table of contents does
require indentation based on level in heirarchy.

This would be *much* easier if you used the "plain" <c> elements instead of the pernicious c0x elements, whose spurious numbered element typing, as you've discovered, just gets in the way of their @level typing, which is what you really care about -- resulting in the nasty code David showed.


If you can't do that (maybe your writers insist for some unfathomable reason that c0x elements are easier), you can convert c0x elements easily to c elements with a modified identity transform:

<xsl:template match="node()">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates select="node()"/>
  </xsl:copy>
</xsl:template>

<xsl:template match="c01 | c02 | c03 | c04 | c05 | c06 | c07 | c08 | c09 | c10">
<c>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="node()"/>
</c>
</xsl:template>


Then problems like yours (the ToC thing) become much easier and cleaner.

If for some reason you have to convert the opposite way -- an EAD instance that uses plain components into one that uses numbered components -- that's a bit harder; but it's still a stylesheet in two templates.

Cheers,
Wendell


====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.