Scott Smith wrote:
First, you're right about Xalan (1.1; the xerces c++ library is 2.7.0).
Xalan-C 1.10, not Xalan-C 1.1 -- there is a difference.
Second, I hear what you are saying. What I don't understand is why ALL of the tags that pulled data from the no-namespace xml file didn't also have the xmlns="". In the original xsl, I pull 20 some odd data tags from the original xml file and the only one that caused the xmlns="" was this one.
It's difficult to say why without seeing the full output. Remember that
namespace bindings are hierarchical within an XML document, so any elements
in the result tree that are descendants of an element where the default
namespace is not defined will not need a namespace declaration that
undefines it. For example:
<?xml version="1.0" encoding="UTF-8"?>
<stocks xmlns="http://www.fred.com/something">
<security xmlns="" exchange="NASDAQ" ticker="BMET">
<example-child-element/>
</security>
<security xmlns="" exchange="NYSE" ticker="JNJ"/>
</stocks>
What I want is that all of the elements, attributes, etc. in the output xml
file are under the www.fred.com/something namespace.
Then you need to make sure _all_ of the literal result elements in your
stylesheet are in that namespace. The easiest way is to place the default
namespace declaration in the xsl:stylesheet element:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.fred.com/something">
...
You probably _don't_ want the attributes in that namespace, but, if you do,
you'll need to use a prefix that is bound to that namespace for the
attributes, since the default namespace does not apply to attribute names.
Can someone point me to an FAQ or tutorial article that explains the affect of different placements of the namespace declaration?
You might want to read the XML Namespaces recommendation:
http://www.w3.org/TR/REC-xml-names/
It's also important that you understand how an XSLT processor generates the
result tree. There are any number of XSLT books that can explain that, but
Michael Kay's is probably the best.
Dave
--~------------------------------------------------------------------
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>
--~--