Announcement Announcement Module
Collapse
No announcement yet.
AbstractXsltView stylesheetlocation not working in 1.1RC2 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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.

      Comment


      • #4
        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()?

        Comment


        • #5
          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,

          Comment


          • #6
            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.

            Comment


            • #7
              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,

              Comment

              Working...
              X