Solved

Defining a namespace with in an XSLT

Posted on 2002-07-11
5
233 Views
Last Modified: 2013-11-19
I am using a xsltproc to transform xml.  When I execute the transform I get a series of errors that I do not understand.  I will add the XSLT, initial XML and output as additional comments.

Hopefully someone will understand this.
0
Comment
Question by:whitej8
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 

Author Comment

by:whitej8
ID: 7146165
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--

   Sage EAD to DC transformation
   Jason White
   Feburary 8, 2002
   Emory University General Libraries

-->
   <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

      <!--***********************  Element Root ***********************-->       
      
   <xsl:template match="sage">
      <oai_dc:dc
          xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
          xmlns:dc="http://purl.org/dc/elements/1.1/"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
              
          <xsl:apply-templates select="EMUCOLL"/>
          <xsl:apply-templates select="EMUFORMAT"/>
          <xsl:apply-templates select="EMUTITLE"/>
          <xsl:apply-templates select="EAD"/>
          <xsl:apply-templates select="DAOLOC"/>
      </oai_dc:dc>
   </xsl:template>

    <xsl:template match="DAOLOC">
      <identifier><xsl:value-of select="."/></identifier>    
    </xsl:template>

    <xsl:template match="EMUCOLL">
      <dc:source><xsl:value-of select="."/></dc:source>
    </xsl:template>

    <xsl:template match="EMUFORMAT">
      <dc:format><xsl:value-of select="."/></dc:format>
    </xsl:template>      
      
    <xsl:template match="EMUTITLE">
      <dc:title><xsl:value-of select="/sage/EAD/FINDAID/ARCHDESC/DSC/C/DID/UNITTITLE"/></dc:title>
    </xsl:template>
            
    <!--***********************  EAD ***********************-->
    <xsl:template match="EAD">
      <xsl:apply-templates select="EADHEADER"/>
      <xsl:apply-templates select="FRONTMATTER"/>
      <xsl:apply-templates select="FINDAID"/>                  
    </xsl:template>
   
    <!--***********************  EAD HEADER ***********************-->
    <xsl:template match="EADHEADER">
      <xsl:apply-templates select="FILEDESC"/>       
    </xsl:template>
   
    <!--***********************  FILEDESC ***********************-->
    <xsl:template match="FILEDESC"></xsl:template>
   
    <!--***********************  FRONTMATTER ***********************-->
    <xsl:template match="FRONTMATTER">
      <xsl:apply-templates select="TITLEPAGE"/>
    </xsl:template>
   
    <!--***********************  TITLEPAGE ***********************-->
    <xsl:template match="TITLEPAGE">
      <xsl:apply-templates select="TITLEPROPER"/>
      <xsl:apply-templates select="AUTHOR"/>
    </xsl:template>
      
    <xsl:template match="AUTHOR">
      <dc:publisher><xsl:value-of select="."/></dc:publisher>
    </xsl:template>
      
    <!--***********************  FINDAID ***********************-->
    <xsl:template match="FINDAID">
      <xsl:apply-templates select="ARCHDESC"/>
    </xsl:template>      
      
    <!--***********************  ARCHDESC ***********************-->
    <xsl:template match="ARCHDESC">
      <xsl:apply-templates select="DID"/>
      <xsl:apply-templates select="DSC"/>                                                      
    </xsl:template>      
   
    <xsl:template match="DID">
      <xsl:apply-templates select="UNITDATE"/>
    </xsl:template>
   
    <xsl:template match="UNITDATE">
      <dc:date><xsl:value-of select="."/></dc:date>
    </xsl:template>
   
    <!--***********************  DSC ***********************-->      
    <xsl:template match="DSC">
      <xsl:apply-templates select="C"/>
    </xsl:template>                  

    <!--***********************  C ***********************-->      
    <xsl:template match="C">
      <xsl:apply-templates select="SCOPECONTENT"/>
      <xsl:apply-templates select="DAO"/>
      <xsl:apply-templates select="ADMININFO"/>
      <xsl:apply-templates select="CONTROLACCESS"/>
      <xsl:apply-templates select="ODD"/>      
    </xsl:template>                        
   
    <!--***********************  DID ***********************-->      
    <xsl:template match="DID">
      <xsl:apply-templates select="UNITTITLE"/>
      <xsl:apply-templates select="GENREFORM"/>
      <xsl:apply-templates select="ORIGINATION"/>
      <xsl:apply-templates select="PHYSDESC"/>            
    </xsl:template>                        
          
    <xsl:template match="UNITTITLE">
      <dc:title><xsl:value-of select="."/></dc:title>
    </xsl:template>
            
    <xsl:template match="GENREFORM">
      <dc:type><xsl:value-of select="."/></dc:type>
    </xsl:template>

    <!--***********************  ORIGINATION ***********************-->
    <xsl:template match="ORIGINATION">    
      <dc:publisher><xsl:value-of select="."/></dc:publisher>
      <xsl:apply-templates select="BIBREF"/>
    </xsl:template>
            
  <xsl:template match="BIBREF"></xsl:template>            

    <!--***********************  PHYSDESC ***********************-->
    <xsl:template match="PHYSDESC">    
      <dc:format>
          <xsl:value-of select="EXTENT"/>
          <xsl:value-of select="GENREFORM"/>
          <xsl:value-of select="DIMENSIONS"/>
          <xsl:value-of select="PHYSFACET"/>                        
      </dc:format>
    </xsl:template>
      
    <!--***********************  SCOPECONTENT ***********************-->      
    <xsl:template match="SCOPECONTENT">
      <xsl:apply-templates select="HEAD"/>                              
        <dc:description><xsl:value-of select="."/></dc:description>
    </xsl:template>
      
    <xsl:template match="HEAD"></xsl:template>
      
    <!--***********************  DAO ***********************-->
    <xsl:template match="DAO">    
      <xsl:apply-templates select="DAODESC"/>
    </xsl:template>
            
    <xsl:template match="DAODESC">
        <dc:format><xsl:value-of select="."/></dc:format>
    </xsl:template>

    <!--***********************  ADMININFO ***********************-->
    <xsl:template match="ADMININFO">    
      <xsl:apply-templates select="USERESTRICT"/>
      <xsl:apply-templates select="ALTFORMAVAIL"/>
      <xsl:apply-templates select="PREFERCITE"/>
    </xsl:template>

    <xsl:template match="USERESTRICT">
      <dc:rights><xsl:value-of select="."/></dc:rights>
    </xsl:template>      
      
    <xsl:template match="PREFERCITE">
        <dc:rights><xsl:value-of select="."/></dc:rights>
    </xsl:template>      
      
    <xsl:template match="ALTFORMAVAIL">
        <dc:format><xsl:value-of select="."/></dc:format>
    </xsl:template>

    <!--***********************  CONTROLACCESS ***********************-->
    <xsl:template match="CONTROLACCESS">    
      <xsl:apply-templates select="CORPNAME"/>
      <xsl:apply-templates select="PREFERCITE"/>
      <xsl:apply-templates select="PERSNAME"/>
    </xsl:template>      

    <xsl:template match="CORPNAME">
      <dc:subject><xsl:value-of select="."/></dc:subject>
    </xsl:template>

    <xsl:template match="GEOGNAME">
      <dc:subject><xsl:value-of select="."/></dc:subject>
    </xsl:template>
   
    <xsl:template match="PERSNAME">
      <dc:subject><xsl:value-of select="."/></dc:subject>
    </xsl:template>

    <!--***********************  ODD ***********************-->
    <xsl:template match="ODD"></xsl:template>

</xsl:stylesheet>
0
 

Author Comment

by:whitej8
ID: 7146166
<?xml version='1.0' encoding='ISO-8859-1' ?><sage>
 <EMUACC>06080100PHOR00TODDWI004 </EMUACC><EMUCOLL>Witness to the Holocaust project</EMUCOLL><EMUFORMAT>Photo</EMUFORMAT><EMUTITLE>A scaffold in Ohrdruf</EMUTITLE><DOCTYPE> EAD PUBLIC "-//Society of American Archivists//DTD ead.dtd  (Encoded Archival Description (EAD))//EN" "EAD.DTD"></DOCTYPE><EAD><EADHEADER FINDAIDSTATUS="Unverified-full-draft"><EADID>EMU 06080100PHOR00TODDWI004   </EADID><FILEDESC><TITLESTMT><TITLEPROPER></TITLEPROPER></TITLESTMT></FILEDESC></EADHEADER><FRONTMATTER><TITLEPAGE><TITLEPROPER></TITLEPROPER><AUTHOR>Emory University</AUTHOR><ADDRESS><ADDRESSLINE>Robert W. Woodruff Library</ADDRESSLINE><ADDRESSLINE>Archives and Special Collections</ADDRESSLINE><ADDRESSLINE>Atlanta, GA 30322-  3870</ADDRESSLINE><ADDRESSLINE>404-727-6887</ADDRESSLINE></ADDRESS><PUBLISHER>Encoded as part of the SAGE Digital Archive Project: A Collaborative Project between the Georgia Institute of Technology and Emory University, 1997-2000.       </PUBLISHER><SPONSOR AUDIENCE="internal">Funding for the SAGE Digital Archive Project was provided by a local foundation.    </SPONSOR></TITLEPAGE></FRONTMATTER><FINDAID><ARCHDESC LANGUAGE="en" LEVEL="item" LANGMATERIAL="en"><DID></DID><DSC TYPE="othertype"><C LEVEL="item" LANGMATERIAL="en"><DID><UNITID>06080100PHOR00TODDWI004</UNITID><UNITTITLE>A scaffold in Ohrdruf   </UNITTITLE><UNITDATE>- -    </UNITDATE><GENREFORM SOURCE="LOCAL"  ENCODINGANALOG="755">Photo </GENREFORM><ORIGINATION>Todd, William (Donor)      <BIBREF></BIBREF></ORIGINATION><PHYSDESC><EXTENT>1  </EXTENT><GENREFORM SOURCE="GMGPC" ENCODINGANALOG="755">silver gelatin print    </GENREFORM><DIMENSIONS>Image size: 4 1/2" x 6 1/2";  Paper size: 5" x 7"</DIMENSIONS><PHYSFACET>bent, scratches, damage on negative, moisture wrinkling.  Reverse of photo: glue residue with black paper fibers, paper  label.   </PHYSFACET></PHYSDESC></DID><SCOPECONTENT><HEAD>Content Note:</HEAD>A scaffold near the barracks.  Three liberators stand behind it, looking at it.  Numbered 76 on the reverse.          </SCOPECONTENT><DAO EXT.PTR=" 06080100PHOR00TODDWI004.JPG "><DAODESC>JPG (72 dpi); 66 KB  Digital image created as part of SAGE project, 1998.</DAODESC></DAO><ADMININFO><USERESTRICT>Researchers should contact the repository for terms governing the use of the collection. </USERESTRICT><ALTFORMAVAIL>Negative.  TIFF image (400 dpi).  JPG image (72 dpi).        </ALTFORMAVAIL><PREFERCITE>[after identification of item(s)], Fred Roberts Crawford Witness to the Holocaust Project (Emory University) files, Special Collections Department, Robert W. Woodruff Library, Emory University.          </PREFERCITE></ADMININFO><CONTROLACCESS><CORPNAME SOURCE="LCNAF">Ohrdruf (Concentration camp)</CORPNAME><GEOGNAME SOURCE=""></GEOGNAME><PERSNAME SOURCE="LOCAL">Todd, William</PERSNAME></CONTROLACCESS><ODD></ODD></C></DSC></ARCHDESC></FINDAID></EAD></sage>
0
 

Author Comment

by:whitej8
ID: 7146175
sageEAD2dc.xsl:35: warning: Namespace prefix dc is not defined
        <dc:source><xsl:value-of select="."/></dc:source>
           ^
sageEAD2dc.xsl:39: warning: Namespace prefix dc is not defined
        <dc:format><xsl:value-of select="."/></dc:format>
           ^
sageEAD2dc.xsl:43: warning: Namespace prefix dc is not defined
        <dc:title><xsl:value-of select="/sage/EAD/FINDAID/ARCHDESC/DSC/C/DID/UNITTITLE
          ^
sageEAD2dc.xsl:73: warning: Namespace prefix dc is not defined
        <dc:publisher><xsl:value-of select="."/></dc:publisher>
              ^
sageEAD2dc.xsl:92: warning: Namespace prefix dc is not defined
        <dc:date><xsl:value-of select="."/></dc:date>
         ^
sageEAD2dc.xsl:118: warning: Namespace prefix dc is not defined
        <dc:title><xsl:value-of select="."/></dc:title>
          ^
sageEAD2dc.xsl:122: warning: Namespace prefix dc is not defined
        <dc:type><xsl:value-of select="."/></dc:type>
         ^
sageEAD2dc.xsl:127: warning: Namespace prefix dc is not defined
        <dc:publisher><xsl:value-of select="."/></dc:publisher>
              ^
sageEAD2dc.xsl:135: warning: Namespace prefix dc is not defined
        <dc:format>
           ^
sageEAD2dc.xsl:146: warning: Namespace prefix dc is not defined
        <dc:description><xsl:value-of select="."/></dc:description>
                       ^
sageEAD2dc.xsl:157: warning: Namespace prefix dc is not defined
        <dc:format><xsl:value-of select="."/></dc:format>
                  ^
sageEAD2dc.xsl:168: warning: Namespace prefix dc is not defined
        <dc:rights><xsl:value-of select="."/></dc:rights>
           ^
sageEAD2dc.xsl:172: warning: Namespace prefix dc is not defined
        <dc:rights><xsl:value-of select="."/></dc:rights>
                  ^
sageEAD2dc.xsl:176: warning: Namespace prefix dc is not defined
        <dc:format><xsl:value-of select="."/></dc:format>
                  ^
sageEAD2dc.xsl:187: warning: Namespace prefix dc is not defined
        <dc:subject><xsl:value-of select="."/></dc:subject>
            ^
sageEAD2dc.xsl:191: warning: Namespace prefix dc is not defined
        <dc:subject><xsl:value-of select="."/></dc:subject>
            ^
sageEAD2dc.xsl:195: warning: Namespace prefix dc is not defined
        <dc:subject><xsl:value-of select="."/></dc:subject>
            ^
compilation error: file sageEAD2dc.xsl line 35 element source
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 39 element format
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 43 element title
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 73 element publisher
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 92 element date
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 118 element title
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 122 element type
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 127 element publisher
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 135 element format
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 146 element description
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 157 element format
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 168 element rights
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 172 element rights
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 176 element format
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 187 element subject
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 191 element subject
Namespaces prefix  used for multiple namespaces
compilation error: file sageEAD2dc.xsl line 195 element subject
Namespaces prefix  used for multiple namespaces
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
  <source>Witness to the Holocaust project</source>
  <format>Photo</format>
  <title>A scaffold in Ohrdruf   </title>
  <publisher>Emory University</publisher>
  <description>Content Note:A scaffold near the barracks.  Three liberators stand behind it, looking at it.  Numbered 76 on the reverse.          </description>
  <format>JPG (72 dpi); 66 KB  Digital image created as part of SAGE project, 1998.</format>
  <rights>Researchers should contact the repository for terms governing the use of the collection. </rights>
  <format>Negative.  TIFF image (400 dpi).  JPG image (72 dpi).        </format>
  <rights>[after identification of item(s)], Fred Roberts Crawford Witness to the Holocaust Project (Emory University) files, Special Collections Department, Robert W. Woodruff Library, Emory University.          </rights>
  <subject>Ohrdruf (Concentration camp)</subject>
  <subject>Todd, William</subject>
</oai_dc:dc>
0
 
LVL 27

Accepted Solution

by:
BigRat earned 100 total points
ID: 7146203
How strange?

I don't know the tool, but I'm surprised it complains so loudly about namespaces; since the output method is XML it is of no consequence if they are not defined.

Try, as a test, to move the namespace declarations from <oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
</oai_dc:dc>

to the xsl:stylesheet declaration. It might be that it has taken the namespace declarations local to that template (ie sage).


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">


HTH
0
 

Author Comment

by:whitej8
ID: 7146283
That was it thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question