Great point, and thanks for mentioning it! I don't know that the list of safely strippable elements already exists for EAD, but that could be created pretty easily from the schema, as you mention. Perhaps something to do over the weekend.
Just in case, Aaron, I'd remove the xsl:strip-space line, as Wendell suggests. I think one of the reasons that I often keep it there myself is just out of habit and also because the default Archivists' Toolkit EAD transformation stylesheets would guard against this by adding a preceding space if there were any preceding elements for the mixed-content elements (i.e. <xsl:if test="preceding-sibling::*">  </xsl:if>), but it would certainly be better not to strip spaces when doing an identity transformation.
Mark
-----Original Message-----
From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf Of Wendell Piez
Sent: Wednesday, April 09, 2014 3:57 PM
To: [log in to unmask]
Subject: Re: sorting by unitid
Hi,
I hope you guys are aware that xsl:strip-space="*" will strip all the whitespace-only text nodes, including those in mixed content! :-)
So if you have
<p><emph render="bold">bold</emph> <emph render="italic>italic</emph></p>
your result will have
<p><emph render="bold">bold</emph><emph render="italic>italic</emph></p>
This will rarely but dependably happen (rarely only because it's rare to have whitespace like this), but when it does, it's hard to see and hard to fix.
For a modified identity transformation, it is often just as good to leave the xsl:strip-space out. Whitespace in the source will appear in the result.
Or, to be proper about it, you have a choice:
(a) strip-space only from elements that have only element content (whitespace appearing there will always be cosmetic and disposable).
You can get this list of elements from a schema.
(b) if the document declares an XSD or DTD and you are using XSLT 2.0, and Saxon, call it with -strip=ignorable. (Alas this doesn't work with RNG validation.)
I should think the list of safely strippable elements for (versions
of) EAD ought to be somewhere. Is it?
Cheers, Wendell
On Wed, Apr 9, 2014 at 3:18 PM, Lyons, Bert <[log in to unmask]> wrote:
> Aaron –
>
>
>
> We use this stylesheet to sort by unitid:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"
> xmlns:marc="http://www.loc.gov/MARC21/slim"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> exclude-result-prefixes="marc xlink"> <xsl:output
> omit-xml-declaration="yes" encoding="UTF-8" indent="yes"/>
>
> <xsl:strip-space elements="*"/>
>
>
> <xsl:template match="node()|@*">
> <xsl:copy>
> <xsl:apply-templates select="node()|@*"/>
> </xsl:copy>
> </xsl:template>
>
> <xsl:template match="c01">
>
> <xsl:copy>
> <xsl:apply-templates select="@*"/>
>
> <xsl:apply-templates select="c02">
> <xsl:sort select="./did/unitid" data-type="text"/>
>
> </xsl:apply-templates>
> </xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
>
>
>
> Perhaps you can use it as a guide to craft your own.
>
>
>
> Best regards –
>
>
>
> Bert
>
>
>
> Bertram Lyons, CA
>
> Digital Assets Manager / Folklife Specialist
>
> American Folklife Center
>
> Library of Congress
>
> www.loc.gov/folklife
>
>
>
> From: Encoded Archival Description List [mailto:[log in to unmask]]
> On Behalf Of Cusick, Aaron M
> Sent: Wednesday, April 09, 2014 2:40 PM
> To: [log in to unmask]
> Subject: sorting by unitid
>
>
>
> Hello,
>
>
>
> I have a container list in a finding aid that I would like to be able
> to sort ascending by the unitids, which are currently out of order.
> The basic structure is:
>
>
>
> <c01 level=”series”>
>
> <c02 level=”file”>
>
> <did>
>
> <unittitle>Title</unittitle>
>
> <unitid>1</unitid>
>
> </did>
>
> </c02>
>
> …
>
> </c01>
>
>
>
> I am not familiar enough with xslt to make this work on my own. Could
> anyone assist me by providing a basic stylesheet? Thanks.
>
>
>
> Aaron Cusick
>
> Digital Services Section
> State Archives of North Carolina
> 4614 Mail Service Center
> Raleigh, N.C. 27699-4614
> [log in to unmask]
> 919.807.7347
>
> E-mail correspondence to and from this address may be subject to the
> North Carolina Public Records Law "NCGS.Ch.132" and may be disclosed
> to third parties by an authorized state official.
>
>
--
Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
|