[OAI-implementers] Namespaces in elements

Thomas G. Habing thabing@uiuc.edu
Tue, 29 Apr 2003 10:14:04 -0500


Jozef Kruger wrote:
> Hi everybody,
> 
> I just implemented the output of my oai server by transforming our own
> xml format to for example dublin core (each supported output format
> having it's own .xsl stylesheet), however, in the transformed xml MSXML
> has replicated the dublin core namespace for each dc element:
> <dc:title
> xmlns:dc="http://purl.org/dc/elements/1.1/">Walangara</dc:title> 
> Where it was:
> <dc:title>Walangara</dc:title> 
> 
> My question is, is this a problem?
> Hussein's repository explorer does NOT complain about this, so that made
> me feel a little confident.
> 
> Cheers,
> Jozef Kruger (Adlib Information Systems B.V. the Netherlands)
> _______________________________________________
> OAI-implementers mailing list
> List information, archives, preferences and to unsubscribe:
> http://oaisrv.nsdl.cornell.edu/mailman/listinfo/oai-implementers
> 
> 

Hi Jozef,

Technically from an XML standpoint it is not a problem, but it is a terrible 
waste of bytes.

I think I've run into this problem with MSXML previously also.  If I 
remember correctly I solved it by using different ways to create the output 
elements.  In XSLT you can create output elements either by inserting the 
element literally into the XSLT, such as the oai_dc:dc element below:

<xsl:template match="/">
   <oai_dc:dc>
     <xsl:apply-templates/>
   </oai_dc:dc>
</xsl:template>

Or, by using the the xsl:element tag, as shown:

<xsl:template match="/">
   <xsl:element name="oai_dc:dc">
     <xsl:apply-templates/>
   </xsl:element>
</xsl:template>

If I remember correctly, by mixing and matching which technique I used to 
generate the output elements, I was able to eliminate the extraneous 
namespace declarations.

Try using the literal technique <oai_dc:dc> for the root element, but the 
<xsl:element name="dc:creator"> technique for the child elements.

If after some experimentation this doesn't seem to work either, I could go 
and maybe find some of my old stylesheets to see exactly what I did.

Regards,
	Tom


-- 
Thomas Habing
Research Programmer, Digital Library Projects
University of Illinois at Urbana-Champaign
155 Grainger Engineering Library Information Center, MC-274
thabing@uiuc.edu, (217) 244-4425
http://dli.grainger.uiuc.edu