Problem with default namespace declaration and XSLT 2003-06-30 - By Persson Richard
I am trying to do a XSL transformation of a XML file using the class javax.xml.transform.Transformer and an external XSL file. The XSL file performs a very simple copy of the entire input to the output.
XSL-File: ---------- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="ISO-8859-1"/>
<xsl:template match="Message"> <xsl:copy-of select="."/> </xsl:template>
</xsl:stylesheet> -----------
Problem: -------------- If the input XML looks like (note default namespace declaration has no namespace prefix 'xmlns=...'): <?xml version="1.0" encoding="ISO-8859-1"?> <Message xmlns="http://www.dot.com/xmlstds/request"> <Type V="H"/> <MsgVersion>v1.0 2002-11-08</MsgVersion> <MIGversion>v1.0 2002-11-08</MIGversion> ...
I get a value-of result from the XSLT.
But, if the input XML has got a namespace declaraion with namespace prefix, 'xmlns:foo="http://www.dot.com/xmlstds/request' I get what I want, a copy-of result of the input file.
Is the javax.xml.transform.Transformer class failing or am I on the wrong track?
/Richard Persson
--------------- Richard Persson TietoEnator AS
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|