You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2002/12/13 16:25:38 UTC
DO NOT REPLY [Bug 15361] New: -
Using default namespaces in XML file will not currently work with XALAN
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15361>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15361
Using default namespaces in XML file will not currently work with XALAN
Summary: Using default namespaces in XML file will not currently
work with XALAN
Product: XalanJ2
Version: 2.2.x
Platform: All
OS/Version: Windows NT/2K
Status: NEW
Severity: Major
Priority: Other
Component: Xalan
AssignedTo: xalan-dev@xml.apache.org
ReportedBy: vendor_bugs@list.atg.com
CC: vendor_bugs@list.atg.com
I have a customer that has the following in an xml file:
<?xml version="1.0" encoding="utf-8"?>
<a xmlns='http://www.w3.org/TR/REC-html40'>
<b>Frobnostication</b>
</a>
XALAN will not process this when validating against an XSL file. I tried
running this against an XSL stylesheet using XALAN-j_2_2_D14.jar and XALAN-
j_2_4_0.jar (the most current version of XALAN). Neither of them worked if you
used a default namespace.
I have heard that you cannot use default namespaces with XML files- only within
XSL stylesheets. Is this true? However, my customer is getting these XML files
from Microsoft, and they claim that you *can* use default namespaces with XML
files:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpcondefaultnamespaces.asp
I'm not sure if Microsoft is simply not adhering to XML spec, or if this is a
XALAN bug.
Just to let you know, there is a workaround. The first would be: Don't use
default namespaces in XML files. Take them out if they are there.
Another possible workaround would rely on the customer being able to modify the
xsl file. If they get in an xml file (that they cannot edit) that has a default
namespace, they can 'trick' the xsl file into validating all of the element
tags in the XML file against the default namespace. The way to do this is by
declaring a namespace in the xsl file. So, simply declare:
<xsl:stylesheet version="1.0"
xmlns:foo="<default_namespace_url_in_xml_file>" exclude-result-prefixes="foo">
in the xsl file. Then, give all of your elements in the XSL file the
prefix "foo:". One other thing you may notice is the
exclude-result-prefixes="foo"
in the above declaration. This is included so that the resulting html will not
include bogus lines such as:
<br xmlns:foo="http://www.unisys.com/WebServices/">
These lines are not needed, and the exclude-result-prefixes
statement removes them.