[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] namespace reference in xsl without being attribute in output xml


Subject: Re: [xsl] namespace reference in xsl without being attribute in output xml
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 28 Jan 2005 14:31:39 GMT

   I want to generate an xml file, with namespace references, like: 

   <?xml version="1.0" encoding="UTF-8"?> 
  <!DOCTYPE serial-issue PUBLIC "-//ES//DTD serials issue DTD version 5.1.0//EN//XML" "si510.dtd"> 
  <serial-issue> 
  <issue-info> 
  <ce:pii>S9999-9994(04)X0057-X</ce:pii> 
  ... 
  </issue-info> 
  ... 
  </serial-issue> 


   "Use of default namespace declaration attribute in DTD not supported.

Note the wording here: "not supported" rather than "error". this is a
deliberate non-conformance on the part of Microsoft. There is nothing
wrong with the file, however msxml is designed only to accept a subset
of legal XML documents.


  But then I get the namespace attribute in the output file: 

  ... 
  <serial-issue xmlns:ce=" http://www.elsevier.com/xml/common/dtd "> 
  ... 
  </serial-issue> 

This usage is valid according to the DTD (isn't it?) Why is this form a
problem?



If you do generate a file of the form you want (which is quite hard with
XSLT) then the resulting file will not work with microsoft parsers.
Also the namespace recommendation  itself expiltly advises against
relying on DTD defaulting as non-validating parsers might not read the
DTD. (For example the parser in mozilla/netscape never reads external
dtds so will generate namespace errors on the form that you require).

If you really want this form, the easiest way would be to pipe the output
of xslt through 
sed -e "s@xmlns:ce=.http://www.elsevier.com/xml/common/dtd.@@"


David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


Current Thread
Keywords