[Yanel-commits] rev 20646 - public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources

josias at wyona.com josias at wyona.com
Thu Dec 7 15:46:28 CET 2006


Author: josias
Date: 2006-12-07 15:46:26 +0100 (Thu, 07 Dec 2006)
New Revision: 20646

Modified:
   public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
Log:
global.xsl will only be applied when specified in rti file. otherwise plain xhtml will be displayed.

Modified: public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2006-12-07 13:28:25 UTC (rev 20645)
+++ public/yanel/trunk/src/contributions/resources/wiki/src/java/org/wyona/yanel/impl/resources/WikiResource.java	2006-12-07 14:46:26 UTC (rev 20646)
@@ -114,24 +114,26 @@
             saxParser.parse(wikiParser.getInputStream(), linkChecker);
             
             java.io.ByteArrayOutputStream byteArrayOutputStream = new java.io.ByteArrayOutputStream();
+            
             transformer.transform(new StreamSource(linkChecker.getInputStream()), new StreamResult(byteArrayOutputStream));
             
-            inputStream = new java.io.ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-            
-            transformer = TransformerFactory.newInstance().newTransformer(getXSLTStreamSource(path, repository));
-            transformer.setParameter("yanel.back2context", backToRoot(path, ""));
-            transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
-            
-            byteArrayOutputStream = new ByteArrayOutputStream();
-            transformer.transform(new StreamSource(inputStream), new StreamResult(byteArrayOutputStream));
- 
+            if(getXSLTPath(path) != null) {
+                inputStream = new java.io.ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+                
+                transformer = TransformerFactory.newInstance().newTransformer(getXSLTStreamSource(path, repository));
+                transformer.setParameter("yanel.back2context", backToRoot(path, ""));
+                transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+                
+                byteArrayOutputStream = new ByteArrayOutputStream();
+                transformer.transform(new StreamSource(inputStream), new StreamResult(byteArrayOutputStream));    
+            }
+
             inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
             I18nTransformer i18nTransformer = new I18nTransformer("global", language);
             saxParser = SAXParserFactory.newInstance().newSAXParser();
             saxParser.parse(inputStream, i18nTransformer);
 
             defaultView.setInputStream(i18nTransformer.getInputStream());
-            
             return defaultView;
         } catch (Exception e) {
             log.error(e, e);
@@ -208,13 +210,11 @@
             while ((xsltPath = br.readLine()) != null) {
                 if (xsltPath.indexOf("xslt:") == 0) {
                     xsltPath = xsltPath.substring(6);
-                    log.debug("XSLT Path: " + xsltPath);
+                    log.info("XSLT Path: " + xsltPath);
                     return new Path(xsltPath);
                 }
             }
             log.info("No XSLT Path within: " + rpRTI.getPath());
-            log.info("will use global even if not in RTI file: ");
-            return new Path("/xslt/global.xsl");
         } catch (Exception e) {
             log.warn(e);
         }




More information about the Yanel-commits mailing list