Are you using Java 6?

I tried your example and it works for me with Java 5 but not with Java
6.  

I ran it through the debugger and the problem is in the struts class
SimpleAdapterDocument.  The getXmlStandalone method always throws the
operationNotSupported exception.  

    public boolean getXmlStandalone() {
        throw operationNotSupported();
    }

I assume the transformer in Java 6 calls this method but not the 
transformer in Java 5.



As a workaround, if your just looking for the xml you could specify 
the result as follows using an identity transformation.  This
should output the same xml.

<action name="BUDropdownAjaxAction"
class="download.BUDropdownAjaxAction">
    <result type="xslt">
        <param name="stylesheetLocation">/identity.xsl</param>
        <param name="exposedValue">doc</param>        
    </result>
</action>


You can probably find other identity stylesheets on the web but
here is one that worked for us.


<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0" >
<xsl:output method="xml" indent="yes" encoding="ISO-8859-1"/>

<xsl:template match="node()|@*">
    <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
    </xsl:copy> 
</xsl:template>
                                
<xsl:template match="/">
    <xsl:apply-templates select="node()|@*"/>
</xsl:template>

</xsl:stylesheet>





> -----Original Message-----
> From: Eric Hamacher [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 02, 2008 4:00 PM
> To: Struts Users Mailing List
> Subject: RE: XSLTResult problem
> 
> Thanks for the response.  Yes, it's there.  I am starting to doubt
> whether XSLTResult will in fact transform my Document.  I am 
> looking at:
> 
> http://cse-mjmcl.cse.bris.ac.uk/blog/2007/09/10/1189430125294.html
> 
> as a reference for using XSLTResult without stylesheets.  I was hoping
> that somebody else might be using it this way.
> 
> -----Original Message-----
> From: John Krueger [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 02, 2008 2:51 PM
> To: Struts Users Mailing List
> Subject: RE: XSLTResult problem
> 
> Do you have a public getDoc() method on your action?
> 
> John 
> 
> > -----Original Message-----
> > From: Eric Hamacher [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, July 01, 2008 3:31 PM
> > To: Struts Users Mailing List
> > Subject: XSLTResult problem
> > 
> > Struts 2.0.11
> > 
> >  
> > 
> > Hello:
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> > It appears that XSLTResult is having trouble transforming a simple
> > Document:
> > 
> >  
> > 
> > <?xml version="1.0" ?>
> > 
> > <buidInfo>
> > 
> > <buid>999999</buid>
> > 
> > <buid>9999x99</buid>
> > 
> > </buidInfo>
> > 
> >  
> > 
> >  
> > 
> > My action is producing valid XML.  I don't think it's the 
> > action causing
> > the problem.  The error message printed on the screen:
> > 
> >  
> > 
> > XML Parsing Error: no element found
> > 
> > Location:
> > http://111.222.33.444:8989/ImageManager/download/BUDropdownAja
> > xAction.ac
> > tion?schema=XXXXX
> > 
> > Line Number 1, Column 1:
> > 
> >  
> > 
> >  
> > 
> > Here is the action execute method which creates the Document:
> > 
> >  
> > 
> >     public String execute() throws ParserConfigurationException {
> > 
> >             ImageManagerProperties props = new 
> > ImageManagerProperties();
> > 
> >             props.load();
> > 
> >             
> > 
> >             DocumentBuilderFactory dbfac = 
> > 
> >                 DocumentBuilderFactory.newInstance();
> > 
> >             DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
> > 
> >             doc = docBuilder.newDocument();
> > 
> >     
> > 
> >             Element root = doc.createElement("buidInfo");
> > 
> >             doc.appendChild(root);
> > 
> >             
> > 
> >             File directory = new 
> > File(props.getBaseDownloadDir() + "/" +
> > schema);
> > 
> >             File[] buids = directory.listFiles();
> > 
> >             for (File f: buids) {
> > 
> >                 if (f.isDirectory()) {
> > 
> >                     Element buid = doc.createElement("buid");
> > 
> >                     Text name = doc.createTextNode(f.getName());
> > 
> >                     buid.appendChild(name);
> > 
> >                     root.appendChild(buid);
> > 
> >                 }
> > 
> >             }
> > 
> >             
> > 
> >             return SUCCESS;
> > 
> > }
> > 
> >  
> > 
> > The configuration is as such:
> > 
> >  
> > 
> > <action name="BUDropdownAjaxAction"
> > class="download.BUDropdownAjaxAction">
> > 
> >             <result type="xslt">
> > 
> >                 <param name="exposedValue">doc</param>        
> > 
> >             </result>
> > 
> >  </action>
> > 
> >  
> > 
> > I assume that XSLTResult is available through the struts default
> > settings.
> > 
> >  
> > 
> > Can anybody see something obvious?
> > 
> >  
> > 
> > Regards,
> > 
> > Eric Hamacher
> > 
> >  
> > 
> > ******************************
> > 
> > THIS EMAIL IS INTENDED ONLY FOR THE REVIEW OF THE 
> > ADDRESSEE(S), AND MAY
> > CONTAIN CONFIDENTIAL AND LEGALLY PRIVILEGED INFORMATION. 
> INTERCEPTION,
> > COPYING, DISSEMINATION, OR OTHER USE BY OTHER THAN THE 
> ADDRESSEE(S) IS
> > PROHIBITED AND MAY BE PENALIZED UNDER APPLICABLE PRIVACY 
> LAWS. IF YOU
> > RECEIVED THIS EMAIL IN ERROR, PLEASE DELETE IT AND NOTIFY 
> ME BY RETURN
> > EMAIL TO [EMAIL PROTECTED] *******************************
> > 
> >  
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to