Jennie,
[We have not begun using the Schema yet. So my comments are from the DTD standpoint.]
Their is significant complexity in creating TOC for EAD documents.
As Joseph as stated, the dsc/@type attribute is little help. The @type value is not checked against the dsc. Thus a valid dsc could have a mis-named @type value.
The key is to test for the @level attribute value(s).
Whatever key terms your @level attributes use, the next problem is that series and subseries are not strictly hierarchical with the component structure of the EAD dsc.
Finally, @type='subseries' may or may not be noteworthy for a TOC. The @type='subseries' can be used for many and in many ways simply designating a significant break in the hierarchical processing of the material. (One reason why I insist on having a (@type='subseries' && child::scopecontent) in order to qualify for a TOC entry.)
The necessity arises to iterate through the entire DSC in order to build the TOC.
I have done this with 2 generic templates (EAD_2002_HTML_conv-1.xsl).
Coding practices are really necessary for consistency sake.
[Code below]
Mike Ferrando
Library Technician
Library of Congress
Washington, DC
(202) 707-4454
BTW: You will want to suppress the @IDs in the TOC HTML to stop dup anchor/@name from occurring.
===========================
<!-- File: EAD_2002_HTML_conv-1.xsl -->
<!-- Date: 3 September 2004 -->
<!-- Updated: 03 january 2007 -->
<!-- Creator: Michael A. Ferrando -->
<!-- Editor used: NoteTab Pro 4.5 -->
<!-- EAD 2002 tag set -->
<!-- Library of Congress best practices respected -->
<!-- Templates closed: notestmt -->
<!-- Attributes not respected: @audience -->
<!-- extptr Library of Congress seal respected -->
<!-- Otherwise: extptr become @external-destination links -->
<xsl:template match="c01" mode="desc_series_toc_x">
<xsl:param name="desc_series_query"/>
<xsl:param name="get_names"/>
<xsl:param name="desc_series_toc_nix_container_x"/>
<xsl:variable name="c_n_nm" select="number(substring(name(), 2, string-length(name()))) + 1"/>
<xsl:variable name="fixed_c_sl">
<xsl:if test="string-length($c_n_nm)=1">
<xsl:value-of select="concat('c0', $c_n_nm)"/>
</xsl:if>
<xsl:if test="string-length($c_n_nm)=2">
<xsl:value-of select="concat('c', $c_n_nm)"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="c01_ct">
<xsl:number count="c01"/>
</xsl:variable>
<xsl:variable name="d_s_q">
<xsl:number count="c01"/>
</xsl:variable>
<!-- C01 Rows -->
<!-- spacer row before series -->
<!-- spacer row before series -->
<TR>
<TD VALIGN="top" COLSPAN="14"></TD>
</TR>
<!-- row for unittitle -->
<xsl:apply-templates select="did/unittitle" mode="dsc_did_children">
<xsl:with-param name="lv" select="number(substring(name(), 2, string-length(name())))"/>
<xsl:with-param name="c01_ct" select="$c01_ct"/>
<xsl:with-param name="desc_series_query" select="$d_s_q"/>
<xsl:with-param name="agg_ct" select="number(1000 + $c01_ct)"/>
<xsl:with-param
name="desc_series_toc_nix_container_x"
select="$desc_series_toc_nix_container_x"
/>
</xsl:apply-templates>
<xsl:choose>
<xsl:when test="*[name()=$fixed_c_sl and @level='subseries']">
<xsl:apply-templates select="*[name()=$fixed_c_sl and @level='subseries']" mode="desc_series_toc_xx">
<xsl:with-param name="agg_ct" select="number(1000 + $c01_ct)"/>
<xsl:with-param
name="desc_series_toc_nix_container_x"
select="$desc_series_toc_nix_container_x"
/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- table of contents for container heading -->
<xsl:template match="
c02 |
c03 |
c04 |
c05 |
c06 |
c07 |
c08 |
c09 |
c10 |
c11 |
c12"
mode="desc_series_toc_xx"
>
<xsl:param name="desc_series_query"/>
<xsl:param name="get_names"/>
<xsl:param name="agg_ct"/>
<xsl:param name="desc_series_toc_nix_container_x"/>
<xsl:variable name="t" select="count(parent::*/*)"/>
<xsl:variable name="f" select="count(following-sibling::*)"/>
<xsl:variable name="p" select="$t - $f"/>
<xsl:variable name="c_n_nm" select="number(substring(name(), 2, string-length(name()))) + 1"/>
<xsl:variable name="fixed_c_sl">
<xsl:if test="string-length($c_n_nm)=1">
<xsl:value-of select="concat('c0', $c_n_nm)"/>
</xsl:if>
<xsl:if test="string-length($c_n_nm)=2">
<xsl:value-of select="concat('c', $c_n_nm)"/>
</xsl:if>
</xsl:variable>
<!-- spacer row before subseries -->
<TR>
<TD VALIGN="top" COLSPAN="14"></TD>
</TR>
<!-- row for unittitle -->
<xsl:apply-templates select="did/unittitle" mode="dsc_did_children">
<xsl:with-param name="lv" select="number(substring(name(), 2, string-length(name())))"/>
<xsl:with-param name="c02_ct" select="number($p)"/>
<xsl:with-param name="desc_series_query" select="number($p)"/>
<xsl:with-param name="agg_ct" select="concat($agg_ct, number(1000 + $p))"/>
<xsl:with-param
name="desc_series_toc_nix_container_x"
select="$desc_series_toc_nix_container_x"
/>
</xsl:apply-templates>
<!-- subseries -->
<xsl:choose>
<xsl:when test="*[name()=$fixed_c_sl and @level='subseries']">
<xsl:apply-templates select="*[name()=$fixed_c_sl and @level='subseries']" mode="desc_series_toc_xx">
<xsl:with-param name="agg_ct" select="concat($agg_ct, number(1000 + $p))"/>
<xsl:with-param
name="desc_series_toc_nix_container_x"
select="$desc_series_toc_nix_container_x"
/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
|