Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Namespace issue when using Xalan

From: Andrew Male <ccsajm@---------->
To:
Date: 1/4/2005 3:12:00 PM
I have resolved this issue and thought I should reply to tidy this up.  I 
am not sure this posting would now seem to be  relevant to xsl-list but 
here is the reply anyway!



The basic issue was that although I had constructed my parser to be 
namespace aware when constructing my xml document I had failed to use the 
"createElementNS" method rather than "createElement" which makes a 
DOMSource object in Java able to differentiate between elements in 
different namespaces.



The reason that it worked from the command line and in msxml is because I 
was throwing just a file at Xalan and msxml which processes the namespace 
from the file.  The DomSource object I was using in the java code needs to 
be "told" that an object belongs to another namespace.



Regards Andrew





I have a stylesheet that seems to work for me when using Xalan on the
command line.  The problem presents itself when I attempt the transform
from within a java class that I am using:

The java constructs an rss 2.0 valid file with an extra element defined
in its own namespace, this element is <uobnews:sticky>:

<http://staff.bath.ac.uk/ccsajm/namespace-issue/index.xml>



The xsl that I am using to process this file is:



<http://staff.bath.ac.uk/ccsajm/namespace-issue/html-news-index.xslt>



Basically using the Xpath <xsl:value-of select="uobnews:sticky"> when the
context node is <item> does not return the expected value when this
transform is done from within my java code.  The java is using Xalan
2.6.0, if however I run this through the same Xalan processor on the
command line it works.  I tested this doing the transform in XMLspy and
this also transforms correctly, this was using the built in transformer
and MSXML.

In the java I am using the jaxp apis to do the transform and use the
recommended -Djava.endorsed.dirs when running the class to make sure that
I am definitely using the same version of Xalan as when I run on the
command line.

For some reason when the transform is initiated from within the java code
it is not able to match the node in the uobnews namespace, it seems
perhaps that the namespace is not available...... ??

Any, and I mean absolutely any suggestions would be gratefully received.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent