> On 11/7/2011 10:32 AM, ajay bhadauria wrote: >> Hi, >> >> I need to copy all the child elements from the parent element to output >> xml using xalan c++ transform method. However, one of the child element >> is prefixed but does not have corresponding namespace. >> >> What should I do in xslt so that all the children elements of parent >> element are copied to output xml file without caring the namespace. >> Altova XMLSpy does that but When I use xalan c++ 1.10 , it does not >> copy. >> >> How I can achieve this using xalan c++ 1.10 ? >> >> E.g. >> Input XML file >> ============ >> <?xml version="1.0" encoding="UTF-8"?> >> <SwInt:Request > >> <SwInt:RequestHeader> >> <SwInt1:Requestor>cn=requestor,o=pimxbebb,o=swift1</SwInt1:Requestor> >> <SwInt:Responder>cn=responder,o=pimxus33,o=swift</SwInt:Responder> >> <SwInt:RequestRef>xyz</SwInt:RequestRef> >> </SwInt:RequestHeader> >> </SwInt:Request> > This document does not conform to the namespaces recommendation, so you > cannot transform it using an XSLT processor. > > I have no idea what behavior XML Spy implements, but the XSLT > recommendation is clear that the document must conform to the namespaces > recommendation: > > http://www.w3.org/TR/xslt#section-Introduction > > Is this really the exact document you're using, because I don't see how > Xerces-C would even parse it correctly, much less get any result from > Xalan-C. > > Dave > >
A possibility - but I have not tested - is to coerce ParseSource to create an instance of XSLTInputSource to use for the XML document the Xerces-C WFXMLReader instead of the default IGXMLReader. The WFXMLReader looks only for basic XML well-formedness and does not do any namespace prefix mapping or namespace associated attribute processing. The IGXMLReader by default knows about namespaces and QNames. Your failure is in the use of the Xerces-C IGXMLReader. The XALAN project, as designed, conforms to the documented standards and therefore uses the Xerces-C IGXMLReader. Steven J. Hathaway