Results 1 to 7 of 7

Thread: AbstractXsltView stylesheetlocation not working in 1.1RC2

  1. #1

    Default AbstractXsltView stylesheetlocation not working in 1.1RC2

    I am setting a new stylesheet location in createDomNode of my extended class for AbstractXsltView using setStylesheetLocation, and then calling DOMOutputter().output(doc); So, my xml document created was using the new stylesheet i set in this code. This was working fine - until 1.1RC1, but not with RC2.

  2. #2
    Join Date
    Aug 2004
    Location
    Toronto, Canada
    Posts
    736

    Default

    Please file a bug in Jira (which unfortunately seems to be down right now, but hopefully will be back soon), so it get's taken care of.
    Colin Sampaleanu
    SpringSource - http://www.springsource.com

  3. #3

    Default

    Colin,
    i was looking further into this with debug on- I want to make sure that this is the right way to set the stylesheetlocation. In the code for createDomNode, i call setStylesheetLocation to my new stylesheetlocation. In the debug log, it shows at "DEBUG AbstractXsltView:142 - URL in view is null" and another one at "WARN AbstractXsltView:190 - XSLT view is not configured: will copy XML input", and then, at "bstractXsltView:300 - XSLT transformed OK with stylesheet [URL [file:/C:/java/Tomcat 4.1/webapps/apps/classes/xsl/convert.xsl]]"

    but, the XML view that is rendered, is just the original XML - without the xslt transform done. So, not sure whether my setting of stylesheet in "createDomNode" will work or not.

  4. #4

    Default

    i also looked at the cvs source code for this and I noticed that the renderMergedOutputModel code calls :
    if (!this.cache) {
    logger.warn("DEBUG SETTING: NOT THREADSAFE AND WILL IMPAIR PERFORMANCE: template will be refreshed");
    cacheTemplates();
    }

    which sets the "templates" - but at this point for me, stylesheetLocation is null because i set it in createDomNode.

    So, can that part of code - i.e "cacheTemplates()" be moved after createDomNode call and before doTransform()?

  5. #5
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    Quote Originally Posted by avp12
    So, can that part of code - i.e "cacheTemplates()" be moved after createDomNode call and before doTransform()?
    I don't think so because then you would be unable to cache the template! Performance would really suffer if you did this with XSLT I think (although I don't have any benchmarks to back that up).

    What you need to do is specify a different view in your controller rather than a stylesheet location in your createDomNode. That method should really only be used to domify your model, not configure the view itself. createDomNode will have no additional privileged information than your controller so there should be no difficulty in doing this.

    Regards,
    Darren Davison.
    Public Key: 0xE855B3EA

  6. #6

    Default

    i am not clear how i will then provide my stylesheetlocation so that the XML output which i create in createDomNode will be used by the XsltView to transform my xml output with the stylesheetlocation.

  7. #7
    Join Date
    Aug 2004
    Location
    London, UK
    Posts
    339

    Default

    the stylesheetLocation will already have been set in your views.properties (or equivalent). If you need dynamic decision making as to the view (stylesheet) to use, set up multiple views all with their associated stylesheetLocation values set and choose which one to render in your controller. This keeps the view technology decoupled from the controller too.

    Regards,
    Darren Davison.
    Public Key: 0xE855B3EA

Similar Threads

  1. Replies: 7
    Last Post: Jan 8th, 2013, 04:05 AM
  2. Replies: 1
    Last Post: Oct 6th, 2005, 10:32 AM
  3. AbstractXsltView Usage and Memory problems
    By mark.smithson in forum Web
    Replies: 0
    Last Post: Jun 2nd, 2005, 05:17 AM
  4. Replies: 2
    Last Post: Apr 22nd, 2005, 09:16 AM
  5. Replies: 2
    Last Post: Feb 21st, 2005, 09:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •