On 16/11/2008, Viktor Štujber <[EMAIL PROTECTED]> wrote: >>> Issue 2: unable to query document using element names. >> yes, because its XHTML, where the elements are in a namespace, so you need >> namespace prefixes on the element names in the xpath expression. > In the original document, these elements existed under a default > namespace. My stylesheet also declares this namespace and also uses it > as default. Since the namespaces match, I shouldn't need to do any > extra steps, right? But since it doesn't work, I assume that the > namespaces are actually mutually exclusive instead of matching. I > checked my earlier project where I did something similar, and saw that > it worked there just fine. The only difference that in there, the xsl > stylesheet had no default namespace defined. While xslt1 recognices default namespaces, xpath1 does not. The only way to specify the namespace for xpath1 is the explicit prefix.
>>> Issue 3: namespace declarations in the xml document leak into the output. >> the serializer in XSL processors usually gets namespace decls right, >> honestly. > Yeah, but the xsl:copy-of operation copies over all xmlns: attributes, > even for namespaces that are never used in the final output. For > example, if I attach an xml stylesheet to the xml data file, > xsl:copy-of will introduce the xmlns:xsi namespace declaration to all > copied elements (topmost level). And having funky xmlns: attributes > all over my webpage makes it look strange :) A few remarks might help in understanding what happens to you. - get rid of unused namespaces by using exclude-result-prefixes on the stylesheet - "xmlns" might look like an attribute but it is _not_! - if you create an element in a certain namespace, you can _not_ change the namespace later on as the namespace have become an integral part of the element. If you have an element "mmm" in a certain namespace (or in no-namespace) in your input, and you want to copy it to the result, its namespace gets copied with it. If you want to output an element "mmm" with a different namespace the only way is to create such an element in your stylesheet and add it to the output tree. Hope this helps, Manfred _______________________________________________ xslt mailing list, project page http://xmlsoft.org/XSLT/ [email protected] http://mail.gnome.org/mailman/listinfo/xslt
