Print

Print


It would be GREAT if everybody who posted solutions to this would get them to the maintainers of the EAD help pages  (::waves at Mark Matienzo::)  so they could be posted there under http://www.archivists.org/saagroups/ead/tools.html .  Schema-related "How do I..." questions like this come up regularly and it would be nice to have a resource to point people to.

Likewise the question of "How do I convert a style sheet to use schema rather than DTD?", which I think came up recently and also as part of this discussion.

Michele

-----Original Message-----
From: Encoded Archival Description List [mailto:[log in to unmask]] On Behalf Of Eric Lease Morgan
Sent: Tuesday, April 03, 2012 4:18 PM
To: [log in to unmask]
Subject: duplicate an xml file

Using XSLT, how can I duplicate an XML file sans namespaces?

I have a set of valid DTD-based EAD files that I transform into HTML using a XSL stylesheet. Tastes great and less filling.

I now have a set of valid schema-based EAD files but I can't transform them because namespaces get in the way. 

My tentative solution to this problem is to copy the schema-based EAD file to new XML file sans the name spaces, and then transform the result, but my XPath statements are incorrect. This way I can use a single XSL stylesheet for HTML creation.

Here is a schema-based EAD snippet:

  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <ead
    xsi:schemaLocation = "urn:isbn:1-931666-22-9 http://www.loc.gov/ead/ead.xsd"
    xmlns:ns2          = "http://www.w3.org/1999/xlink"
    xmlns              = "urn:isbn:1-931666-22-9"
    xmlns:xsi          = "http://www.w3.org/2001/XMLSchema-instance">
  
    <eadheader><!-- cool stuff here --></eadheader>
    <archdesc level="collection"><!-- more cool stuff here --></archdesc>
  
  </ead>


Here is a stylesheet:

  <?xml version='1.0'?>
  <xsl:stylesheet
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform' 
    version='1.0'>
    <xsl:template match="/">
      <ead>
        <xsl:copy-of select="/ead/eadheader"/>
        <xsl:copy-of select="/ead/archdesc"/>
      </ead>
    </xsl:template>
  
  </xsl:stylesheet>


The stylesheet works great if I remove all the name spaces from the EAD, but I can't do that because that is the whole point of the transformation. What sort of XPath statements do I need in order successful do the copy-of command? 

-- 
Eric Lease Morgan
University of Notre Dame