> This can be pretty tricky, so you might want to take a look at the 
Namespaces recommendation for more details about the proper namespaces 
for the attributes that declare the namespaces.

Namespaces recommendation?  What do you mean by this?


Robert Goffena
Ball Aerospace & Technologies Corp.
2875 Presidential Dr.
Fairborn, OH 45324-6269
Phone:  (937) 320-4096
Fax:  (937) 429-1687
Email:  rgoff...@ball.com

-----Original Message-----
From: David Bertoni [mailto:dbert...@apache.org] 
Sent: Tuesday, April 28, 2009 9:36 PM
To: xalan-c-users@xml.apache.org
Subject: Re: Attributes Are Not Selected While Transforming a
XercesDomWrapperParsedSource

Goffena, Robert wrote:
> I've converted a xerces dom document to a XercesDOMWrapperParsedSource

> and call XalanTransformer to transform the xml.
> 
> The XalanTransformer succeeds in creating the output, however the 
> transformation behaves as if it could not locate any of the input
xml's 
> attributes.
> 
> Code to make this happen looks like the following:
> 
> DOMDocument pDomDocument = NULL;
> 
> populateDomDocument( pDomDocument ); // a method I have to populate
the 
> dom document with elements/attributes.
Please make sure you're creating a namespace-aware DOM.  You must use 
DOMDocument::createElementNS(), DOMElement::setAttributeNS() and 
DOMDocument::createAttributeNS().  Also, if you expect xsl:copy and 
xsl:copy-of to work correctly with namespace nodes, you will need to 
make sure you add the appropriate attributes in the proper namespace for

each namespace declaration.

This can be pretty tricky, so you might want to take a look at the 
Namespaces recommendation for more details about the proper namespaces 
for the attributes that declare the namespaces.

> 
> XercesParserLiaison theParserLiaison;
> 
> XercesDOMSupport theDOMSupport( theParserLiaison );
> 
> XercesDOMWrapperParsedSource inputData( pDomDocument,
theParserLiaison, 
> theDOMSupport );
> 
> XSLTInputSource stylesheet( "c:/test/test.xsl" );
> 
> XSLTResultTarget result( "c:/test/output.out" );
> 
> XalanTransformer* xtran = new XalanTransformer();
> 
> xtran->transform( inputdata, stylesheet, result );
> 
> Additional details:
> 
> I have dumped the pDomDocument to the c:/test directory and added a 
> processing statement:
> <?xml-stylesheet type="text/xsl" href="test.xsl">
> 
> When I double click on this pDomDocument dump file, it opens in
Internet 
> Explorer, and IE displays the file as having been transformed
correctly 
> (attributes were selected).
And if you let Xalan-C build its own source tree from the markup, I'm 
sure it would work as well. You can test this by using the Xalan
executable:

Xalan -a dump.xml

> 
> The root tag/element of pDomDocument has a namespace.
There is a big difference between markup and the resulting DOM tree, 
particularly with regard to namespaces.

Dave



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this 
 
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.

Reply via email to