Package org.jasig.portal.utils

Examples of org.jasig.portal.utils.XSLT


            log.trace("entering renderXML()");
        }
       
        try {
            // Perform the transformation
            XSLT xslt = XSLT.getTransformer(this, this.runtimeData.getLocales());
           
            Document xml = getXml();
           
            if (log.isTraceEnabled()) {
                log.trace("getXml() returned Document: [" + xml  + "]");
            }
           
            if (xml == null) {
                throw new IllegalStateException("The Document we would transform, as returned by getXml(), was illegally null.");
            }
           
            xslt.setXML(xml);
           
            String xsltUri = getXsltUri();
           
            if (log.isTraceEnabled()) {
                log.trace("getXsltUri() returned: [" + xsltUri + "]");
            }
           
            if (xsltUri == null) {
               
                throw new IllegalStateException("The URI of our XSLT we would use to transform our Document, as returned by getXsltUri(), was illegally null.");
               
                /*
                 * It would probably be a neat feature to detect the case where
                 * getXsltUri() returns null and in that case dump the XML directly to
                 * the ContentHandler, but this is not yet implemented.
                 */
            }
           
            xslt.setXSL(xsltUri);
           
            xslt.setTarget(out);
           
            Map paramsMap = getStylesheetParams();
           
            if (log.isTraceEnabled()) {
                log.trace("getStylesheetParams() returned [" + paramsMap + "]");
            }
           
            if (paramsMap == null) {
                xslt.setStylesheetParameters(new HashMap());
            } else {
                // XSLT requires HashMap or HashTable rather than
                // accepting any Map.
                // We accomodate this by dumping our paramsMap into a
                // HashMap to ensure it is of an acceptable type.
                // Skipping this putAll() where it is unnecessary probably wouldn't
                // result in any worthwhile performance difference.
                HashMap tempHashMap = new HashMap();
                tempHashMap.putAll(paramsMap);
                xslt.setStylesheetParameters(tempHashMap);
            }

            if (log.isTraceEnabled()) {
                log.trace("Configured XSLT as [" + xslt + "]");
            }
               
            xslt.transform();
        } catch (PortalException pe) {
            // we just re-throw PortalExceptions, confident that the
            // channel rendering framework will log and handle them, as
            // defined by the IChannel API we are implementing.
            throw pe;
View Full Code Here


      if (xslURI != null) {
       
        ResourceBundle l18n = ResourceBundle.getBundle(bundleLocation,runtimeData.getLocales()[0]);

        //Now perform the transformation
    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setResourceBundle(l18n);

    xslt.setXML(doc);
        xslt.setXSL(this.getClass().getResource(xslURI).toString());
        xslt.setTarget(out);
        xslt.setStylesheetParameters(params);
        xslt.transform();
      } else {
          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }
  }
View Full Code Here

      }
      String xslURI = set.getStylesheetURI("editItem", runtimeData.getBrowserInfo());
      if (xslURI != null) {

        ResourceBundle l18n = ResourceBundle.getBundle(bundleLocation,runtimeData.getLocales()[0]);
        XSLT xslt = XSLT.getTransformer(this);
        xslt.setResourceBundle(l18n);
       
        xslt.setXML(doc);
        xslt.setXSL(this.getClass().getResource(xslURI).toString());
        xslt.setTarget(out);
        xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
        xslt.transform();
      } else {
          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }
View Full Code Here

        // Prepare the appropriate XML documents for the destination screen
        doAction();
    }

    public void renderXML (ContentHandler out) throws PortalException {
        XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
        xslt.setXML(channelManagerDoc);
        xslt.setXSL(sslLocation, runtimeData.getBrowserInfo());
        xslt.setTarget(out);
        xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
        xslt.setStylesheetParameter("stylesheetCacheSize",
                XSLT.getStylesheetCacheSize()+"");
       
        String action = null;
        switch (state) {
            case DEFAULT_STATE:
                action = "none";
                break;
            case CHANNEL_TYPE_STATE:
                action = "selectChannelType";
                break;
            case GENERAL_SETTINGS_STATE:
                action = "selectGeneralSettings";
                break;
            case CUSTOM_SETTINGS_STATE:
                action = "customSettings";
                break;
            case CHANNEL_DEF_STATE:
                action = "channelDef";
                xslt.setStylesheetParameter("stepID", fixStepID(stepID));
                break;
            case CHANNEL_CONTROLS_STATE:
                action = "selectControls";
                break;
            case CHANNEL_CATEGORIES_STATE:
                action = "selectCategories";
                break;
            case CHANNEL_GROUPS_STATE:
                action = "selectGroups";
                break;
            case CHANNEL_REVIEW_STATE:
                action = "reviewChannel";
                if (errorMsg != null)
                  xslt.setStylesheetParameter("errorMsg", errorMsg);
                errorMsg = null;
                break;
            case MODIFY_CHANNEL_STATE:
                action = "selectModifyChannel";
                break;
            default:
                action = "none";
                break;
        }
        xslt.setStylesheetParameter("action", action);
        xslt.transform();
        if (categoryServant != null && action.equals("selectCategories")) {
            ((IChannel)categoryServant).renderXML(out);
            xslt.setStylesheetParameter("action", "selectCategoriesButtons");
            xslt.transform();
        }
        if (groupServant != null && action.equals("selectGroups")) {
            ((IChannel)groupServant).renderXML(out);
            xslt.setStylesheetParameter("action", "selectGroupsButtons");
            xslt.transform();
        }
     }
View Full Code Here

      }
      String xslURI = set.getStylesheetURI("editGPrefs", runtimeData.getBrowserInfo());
      if (xslURI != null) {

        ResourceBundle l18n = ResourceBundle.getBundle(bundleLocation,runtimeData.getLocales()[0]);
        XSLT xslt = XSLT.getTransformer(this);
        xslt.setResourceBundle(l18n);
       
        xslt.setXML(doc);
        xslt.setXSL(this.getClass().getResource(xslURI).toString());
        xslt.setTarget(out);
        xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
        xslt.transform();
      } else {
          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }
View Full Code Here

        attributesE.appendChild(attributeE);
    }

    doc.appendChild(attributesE);

    XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
    xslt.setXML(doc);
    xslt.setStylesheetParameter("baseActionURL",runtimeData.getBaseActionURL());
    xslt.setStylesheetParameter("downloadWorkerURL",
                                 runtimeData.getBaseWorkerURL(UPFileSpec.FILE_DOWNLOAD_WORKER,true));
    xslt.setXSL(sslLocation, runtimeData.getBrowserInfo());
    xslt.setTarget(out);
    xslt.transform();
  }
View Full Code Here

      if (set == null) {
          throw  new GeneralRenderingException("Unable to determine the stylesheet list");
      }
      String xslURI = set.getStylesheetURI("editItem", runtimeData.getBrowserInfo());
      if (xslURI != null) {
        XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
        xslt.setXML(doc);
        xslt.setXSL(this.getClass().getResource(xslURI).toString());
        xslt.setTarget(out);
        xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
        xslt.transform();
      } else {
          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }
View Full Code Here

      if (xslURI != null) {

        ResourceBundle l18n = ResourceBundle.getBundle(bundleLocation,runtimeData.getLocales()[0]);
       
        //Now perform the transformation
        XSLT xslt = XSLT.getTransformer(this, runtimeData.getLocales());
        xslt.setResourceBundle(l18n);

        xslt.setXML(doc);
        xslt.setXSL(this.getClass().getResource(xslURI).toString());
        xslt.setTarget(out);
        xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
        xslt.transform();
      } else {
          throw  new ResourceMissingException("", "stylesheet", "Unable to find stylesheet to display content for this media");
      }
    }
View Full Code Here

                log.error(e, e);
           
        }

        try {
            XSLT xslt = XSLT
                    .getTransformer(this, this.runtimeData.getLocales());
            xslt.setXML(doc);
            xslt.setXSL(sslLocation, this.ssTitle, this.runtimeData
                    .getBrowserInfo());
            xslt.setTarget(out);
            xslt.setStylesheetParameter("baseActionURL", this.runtimeData
                    .getBaseActionURL());
            xslt.setStylesheetParameter("showStackTrace", String
                    .valueOf(this.showStackTrace));
            xslt.setStylesheetParameter("allowRefresh",
                    Boolean.toString(policy.allowRefresh));
            xslt.setStylesheetParameter("allowReinstantiation",
                    Boolean.toString(policy.allowReinstantiation));
            xslt.transform();
        } catch (Exception e) {
            log.error("CError::renderXML() : Things are bad. " +
                    "Error channel threw Exception rendering its stylesheet.",
                            e);
        }
View Full Code Here

    else
      w.write ("  <suggest>" + sSuggest + "</suggest>\n");

    w.write ("</content>\n");

    XSLT xslt = XSLT.getTransformer(this);
    xslt.setResourceBundle(l10n);
    xslt.setXML(w.toString());
    xslt.setXSL(sslLocation, "main", runtimeData.getBrowserInfo());
    xslt.setTarget(out);
    xslt.setStylesheetParameter("baseActionURL", runtimeData.getBaseActionURL());
    xslt.setStylesheetParameter("guessSuggest", GUESS_SUGGEST);   
    xslt.setStylesheetParameter("theAnswerWasX", THE_ANSWER_WAS_X);   
    xslt.setStylesheetParameter("youHaveMadeXGuesses", YOU_HAVE_MADE_X_GUESSES);   
    xslt.setStylesheetParameter("youGotItAfterXTries", YOU_GOT_IT_AFTER_X_TRIES);
    xslt.setStylesheetParameter("YourGuessOfGuessWasIncorrect", YOUR_GUESS_OF_GUESS_WAS_INCORRECT);   
    xslt.setStylesheetParameter("IAmThinkingOfANumberBetweenXAndY", I_AM_THINKING_OF_A_NUMBER_BETWEEN_X_AND_Y);   
    xslt.transform();
  }
View Full Code Here

TOP

Related Classes of org.jasig.portal.utils.XSLT

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.