Lin, Jessica wrote:
I am using Saxon 8.8 processor also. After I set the
xpath-default-namespace in the root, I still have the same problem.
I am still wondering whether you did get your previous stylesheet to
load and process. Because if it did, I am afraid something else is very
fishy here. It should have given you major errors.
Actually I found even I don't give
xpath-default-namespace="http://directv.com/bitstreams/blueprint" in the
root, I still have the same result.
This has nothing to do with the 'xsi' prefix. This has to do with the
way the xpaths are resolved. If you do not specify it, like in your
earlier example, the <xsl:copy> will be called, but not your overrides
(because the elements you are trying to match exist in a certain
namespace. If you do not specify the namespace, either by prefix or
explicitly in the xsl element, it will not select anything. This is a
very common mistake)
To make sure my Java program run the right XSLT processor, I provided a
service called javax.xml.transform.TransformerFactory which defines
net.sf.saxon.TransformerFactoryImpl under project\META-INF\services
folder.
I don't know enough of that to understand if it is good or not, but to
my recollection, when you set the TransformerFactory incorrectly, I
think you get either a ClassCastException, or a ClassNotFoundException.
Something like that.
To be totally sure of the version and processor you are using, consider
trying the following:
Vendor: <xsl:value-of select="system-property('xsl:vendor')" />
Product: <xsl:value-of select="system-property('xsl:product')" />
Version: <xsl:value-of select="system-property('xsl:version')" />
IMHO, it is very odd behavior. I have never seen Saxon "loosing"
namespaces. Or, more accurately, changing attributes on its own. Because
that is what happens if you remove or change the prefix, the element
will belong to another namespace and will thus be different.
I am under the impression that something is missing in the information
you provide. Can you create a complete and working xslt + input/output
example, as small as possible, where this behavior is still in
existence? Run it from the commandline (or from XML Spy, or from
Eclipse, but not from your own program), to be sure no side effects are
in effect.
Cheers,
-- Abel Braaksma
http://www.nuntia.com