xsl-list
[Top] [All Lists]

namespace reference in xsl without being attribute in output xml

2005-01-28 07:16:57
I need to have a different way to reference a namespace so that I get an output 
xml file that matches a customer specification, presumably by referencing a dtd 
correctly.
This is a long message but I hope it contains enough and only what is needed.
I hope that the words I use are not so incorrect as to confuse.

I have an xml file, from our customer, that looks like: 

<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE orders SYSTEM "ptsiiiorder114.dtd"> 
<?xml-stylesheet type="text/xsl" href="issue.xsl" ?> 
<orders> 
... 
<pii>S9999-9994(04)00218-1</pii> 
... 
</orders> 

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> 

(The sample I'm modeling this on is from another supplier, though IE opens it 
with an error, "Use of default namespace declaration attribute in DTD not 
supported. Error processing resource 'file:///C:/a/Issue.xml'. L...".) 
I'm running the transform from FileMaker 6 (using ? version of xslt 
processor?). My transform looks like: 

<?xml version="1.0" encoding="UTF-8"?> 
<xsl:stylesheet version="1.0" 
xmlns:a=" http://www.filemaker.com/fmpdsoresult " 
xmlns:ce=" http://www.elsevier.com/xml/common/dtd " 
exclude-result-prefixes="a" 
xmlns:xsl=" http://www.w3.org/1999/XSL/Transform "> 
<xsl:output method="xml" doctype-system="si510.dtd" encoding="UTF-8" 
doctype-public="-//ES//DTD serials issue DTD version 5.1.0//EN//XML" 
indent="yes"/> 
<xsl:template match="/"> 
<serial-issue> 
<xsl:variable name="OrderFile" select="document('Order.xml')"/> 
<issue-info> 
<xsl:for-each select="$OrderFile/orders/order/issue-info/general-info"> 
<!-- probably could use a better technique for single valued attributes > 
<ce:pii> 
<xsl:value-of select="pii"/> 
</ce:pii> 
... 
</xsl:for-each> 
</issue-info> 
... 
</serial-issue> 
</xsl:template> 

I include the namespace declaration   xmlns:ce=" 
http://www.elsevier.com/xml/common/dtd "   so that I don't get errors like: 

XML parsing error: 
The prefix 'ce' has not been mapped to any URI 
Line number :29 
Column Number:13 

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

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

I want <serial-issue> with no namespace declaration/attribute. 
The namespace declarations are in the si510.dtd: 

... 
<!-- include the common element pool --> 

<!ENTITY % common.ent 
PUBLIC "-//ES//ELEMENTS common element pool version 1.1.3//EN//XML" 
"common113.ent"> 
%common.ent; 

<!-- namespaces and public identifiers --> 

<!ENTITY % ESSI.xmlns "' http://www.elsevier.com/xml/si/dtd' " > 

<!-- attribute group entities --> 

<!ENTITY % top-level.att 
"xmlns CDATA #FIXED %ESSI.xmlns; 
version CDATA #FIXED '5.1' 
xmlns:ce CDATA #FIXED %ESCE.xmlns; 
xmlns:sb CDATA #FIXED %ESSB.xmlns; 
xmlns:xlink CDATA #FIXED %XLINK.xmlns; 
xml:lang %language; 'en'"> 

<!-- serial-issue (top element) --> 

<!ELEMENT serial-issue ( issue-info, issue-data, issue-body )> 
<!ATTLIST serial-issue 
%top-level.att; > 

<!-- unique identification of the issue --> 

<!ELEMENT issue-info ( ce:pii, ce:doi?, jid, ce:issn, volume-issue-number, 
ce:isbn? )> 
... 

Thanks for any direct help or guidance to references that will help. 

Karjala 
Capital City Press 
Berlin, VT 




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>