Please remove my name from this list serve.
-----Original Message-----
From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf
Of Mike Ferrando
Sent: Monday, April 16, 2007 12:57 PM
To: [log in to unmask]
Subject: Re: Table of Contents links to c01 and c02 tags
Jordon,
I am sending you the stylesheet I created to test your code.
I have added the new code from Michelle.
You will probably want to work at this a little more given that
subseries may occur at a deeper component level.
I have enhanced the stylesheet so you can call some of the big EAD XML
documents we have on line. You can change the variables containing the
http strings as you desire.
[code below]
Mike Ferrando
Library Technician
Library of Congress
Washington, DC
(202) 707-4454
XSLT Processor: SAXON 6.5.5
Output set to XML
<?xml version="1.0" encoding="utf-8"?>
<!-- U: 16 april 2007 -->
<!-- jSteele_ead_xsl_sample_01.xsl -->
<!-- run against: jSteele_ead_xsl-sample_01.xml -->
<!-- tests XSLT code sample from J. Steele via EAD LISTSERVE -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
xmlns:date="java:java.util.Date"
xmlns:simpleDateFormat="java:java.text.SimpleDateFormat"
exclude-result-prefixes="date simpleDateFormat"
>
<xsl:output
version="1.0"
method="xml"
indent="yes"
encoding="utf-8"
omit-xml-declaration="no"
standalone="no"
media-type="text/html"
/>
http://lcweb2.loc.gov/master/music/eadxmlmusic/
<xsl:variable name="folderName">2002/</xsl:variable>
<xsl:variable name="xmlFileName">mu002006.xml</xsl:variable>
<xsl:variable name="url" select="concat($urlPath, $folderName,
$xmlFileName)"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:text>
</xsl:text>
<xsl:comment>
<xsl:text> </xsl:text>
<xsl:value-of
select="
simpleDateFormat:format(
simpleDateFormat:new('EEE.dd.MMMMM.yyyy.h:mm:ss.a.zz'),
date:new()
)
"
/>
<xsl:text> </xsl:text>
</xsl:comment>
<xsl:text>
</xsl:text>
<!-- local document -->
<xsl:apply-templates select="//*[not(parent::*)]"/>
<!-- Library of Congress EAD 2002 XML document -->
<!-- <xsl:apply-templates select="document($url)//*[not(parent::*)]"/>
--> </xsl:template>
<xsl:template match="*[not(parent::*)]">
<xsl:element name="{local-name()}">
<xsl:call-template name="make_toc"/>
</xsl:element>
</xsl:template>
<!--C01 AND C02 LINKS-->
<xsl:template name="make_toc">
<xsl:element name="{local-name()}">
<xsl:for-each
select="
archdesc/dsc/c01[
@level='series' or
@level='subseries' or
@level='subgrp' or
@level='subcollection'
]
"
>
<p>
<a>
<xsl:attribute name="href">
<xsl:text>#series</xsl:text>
<xsl:number count="c01" from="dsc"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="did/unittitle/unitdate">
<xsl:for-each select="did/unittitle">
<xsl:value-of select="text()"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="./unitdate"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="did/unittitle"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="did/unitdate"/>
</xsl:otherwise>
</xsl:choose>
</a>
</p>
<xsl:for-each select="c02[@level='subseries']">
<p style="margin-left:15pt">
<a>
<xsl:attribute name="href">
<xsl:text>#subseries</xsl:text>
<xsl:number count="c01" from="dsc"/>
<xsl:text>-</xsl:text>
<xsl:number count="c02" from="c01"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="did/unittitle/unitdate">
<xsl:for-each select="did/unittitle">
<xsl:value-of select="text()"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="./unitdate"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="did/unittitle"/>
<xsl:text> </xsl:text>
<xsl:apply-templates select="did/unitdate"/>
</xsl:otherwise>
</xsl:choose>
</a>
</p>
</xsl:for-each>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|