Below you will find a bit of code from one of the EAD Cookbook stylesheets.

It tests to see if there is an abstract element (or a child element of
abstract) with text.

If there is text in either of these locations, it looks to see if there is a
Label attribute.
If there is, it inserts the text of the attribute and then that of the
element and/or its child.

If there is no label attribute, it inserts the string "Abstract:" and then
the text of the abstract element and/or its child.

I have seen another test for content but do not recall the syntax.  Perhaps
someone else will enlighten us all.


<xsl:if test="abstract[string-length(text()|*)!=0]">
<xsl:when test="@label">
<tr><td> </td><td valign="top">
<b><xsl:value-of select="@label"/>
<xsl:apply-templates select="abstract"/>
<tr><td> </td><td valign="top">
<b><xsl:text>Abstract: </xsl:text></b></td><td>
<xsl:apply-templates select="abstract"/>


Michael J. Fox
Assistant Director for Library and Archives
Minnesota Historical Society
345 Kellogg Blvd West
St. Paul, MN 55102-2409
651-296-2150  (phone)
651-296-9961  (fax)
[log in to unmask]

-----Original Message-----
From: Marsha Maguire [mailto:[log in to unmask]]
Sent: Wednesday, August 01, 2001 4:21 PM
To: [log in to unmask]
Subject: XSL question

Greetings, all,

This is a question for you folks who work with XSL stylesheets. I'm trying
to learn XSL, but so far I haven't come across a way of eliminating sections
of a finding aid when those sections are empty. For example, sometimes we
describe restrictions on access, and then we include <accessrestrict>, but
by default -- when there are no restrictions -- we leave the field blank. In
my stylesheet, I want the field label and content to print when
<accessrestrict> has information in it, but I don't want to refer to the
field at all if we've left it blank.  In XSL, is there a way to test for a
field with a null value? When <accessrestrict> is not null, then put the
text value into the output document, something like that? How would that be

Many thanks!

Marsha Maguire
Manuscripts and Special Collections Cataloging Librarian
University of Washington Libraries
P.O. Box 352900
Seattle, WA 98195-2900
(206) 543-1879; fax (206) 543-1931
email: [log in to unmask]