Package com.esri.gpt.framework.xml

Examples of com.esri.gpt.framework.xml.XsltTemplate


   * @param url the CSW GetCapabilities URL
   * @return the HTML representation
   * @throws TransformerException if an exception occurs
   */
  public String transformToHtml(String url) throws TransformerException {
    XsltTemplate template = getCompiledTemplate(CswRepository.XSLT_CSW_TO_HTML);
    String xml = template.transform(XmlIoUtil.readXml(url));
    return xml;
  }
View Full Code Here


* @throws SAXException if a SAX parsing exception occurs
*/
private synchronized XsltTemplate getCompiledTemplate(String xsltPath)
  throws TransformerException {
  String sKey = xsltPath;
  XsltTemplate template = XSLTTEMPLATES.get(sKey);
  if (template == null) {
    template = XsltTemplate.makeTemplate(xsltPath);
    XSLTTEMPLATES.put(sKey,template);
  }
  return template;
View Full Code Here

                                  String toEsriIsoXslt)
  throws TransformerException, ParserConfigurationException, SAXException, IOException {
  HashMap<String,String> params = new HashMap<String,String>();
  params.put("documentUuid",Val.chkStr(uuid));
  params.put("fileIdentifier",Val.chkStr(fileIdentifier));
  XsltTemplate template = getCompiledTemplate(toEsriIsoXslt);
  String sXml = template.transform(originalXml,params);
  Document dom = DomUtil.makeDomFromString(sXml,false);
  insertEnclosure(dom,originalXml);
  return XmlIoUtil.domToString(dom);
}
View Full Code Here

      // transform to a known schema if required
      String toKnownSchemaXslt = schema.getInterrogation().getToKnownSchemaXslt();
      if ((toKnownSchemaXslt != null) && (toKnownSchemaXslt.length() > 0)) {
        try {
          XsltTemplate template = getCompiledTemplate(toKnownSchemaXslt);
          DOMSource source = new DOMSource(dom);
         
          StringWriter writer = new StringWriter();
          StreamResult result = new StreamResult(writer);            
          HashMap<String,String> params = new HashMap<String,String>();  
          params.put("currentDate", getDateTime());
          params.put("sourceUrlUuid",
              "{" +
              UUID.nameUUIDFromBytes(
                  this._sourceUri.toLowerCase().toString().getBytes())
                    .toString().toUpperCase() + "}");
          params.put("sourceUrl", this._sourceUri.toLowerCase().contains("?f=json")?this._sourceUri.substring(0,this._sourceUri.indexOf("?")):this._sourceUri);
          if(this._sourceUri != null){
            String[] s = this._sourceUri.split("&");
            for(int i=0;i < s.length; i++){
              int serviceIndexStart = s[i].toUpperCase().indexOf("SERVICE=");
              if( serviceIndexStart > -1){
                params.put("serviceType", s[i].substring(serviceIndexStart+8,s[i].length()));            
              }
            }                 
          }
          template.transform(source,result,params);       
          _transformedToKnownXml = Val.chkStr(writer.toString());
          dom = loadDom(_transformedToKnownXml);
          schema = schemas.interrogate(dom);
          schema.setActiveDocumentXml(_transformedToKnownXml);
        } catch (TransformerException e) {
View Full Code Here

   * @throws SAXException if a SAX parsing exception occurs
   */
  private synchronized XsltTemplate getCompiledTemplate(String xsltPath)
    throws TransformerException {
    String sKey = xsltPath;
    XsltTemplate template = XSLTTEMPLATES.get(sKey);
    if (template == null) {
      template = XsltTemplate.makeTemplate(xsltPath);
      XSLTTEMPLATES.put(sKey,template);
    }
    return template;
View Full Code Here

   * @param xsltPath the path to the XSLT
   * @return the transformed document
   * @throws TransformerException if an exception occurs
   */
  public String transform(String xml, String xsltPath) throws TransformerException {
    XsltTemplate template = this.getCompiledTemplate(xsltPath);
    String result = template.transform(xml);
    return result;
  }
View Full Code Here

   * @return the HTML fragment
   * @throws TransformerException
   * @deprecated Instead use transformDetails(String xml, String xsltPath,Locale locale)
   */
  public String transformDetails(String xml, String xsltPath) throws TransformerException {
  XsltTemplate template = this.getCompiledTemplate(xsltPath)
  return template.transform(xml);
  }
View Full Code Here

      }
     }
     }
  }
          
  XsltTemplate xsl = new XsltTemplate();
  String result =  xsl.transform(XmlIoUtil.domToString(detailsXml), xml, null);
    return result;
  }
View Full Code Here

   * @throws TransformerException if a transformation exception occurs
   */
  private synchronized XsltTemplate getCompiledTemplate(String xsltPath)
    throws TransformerException {
    String sKey = xsltPath;
    XsltTemplate template = XSLTTEMPLATES.get(sKey);
    if (template == null) {
      template = XsltTemplate.makeTemplate(xsltPath);
      XSLTTEMPLATES.put(sKey,template);
    }
    return template;
View Full Code Here

          schematronXslt = Val.chkStr(token);
          if (schematronXslt.length() == 0) continue;
         
       
          // run the validation xsl
          XsltTemplate template = this.getCompiledTemplate(schematronXslt);
          String result = template.transform(xml);
         
          // load the result SVRL document
          Document dom = DomUtil.makeDomFromString(result,true);
          Namespaces namespaces = new Namespaces();
          namespaces.add("svrl","http://purl.oclc.org/dsdl/svrl");
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.xml.XsltTemplate

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.