[exo-jcr-commits] exo-jcr SVN: r4783 - in jcr/trunk/exo.jcr.component.webdav/src/main: resources/xslt and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Aug 19 08:24:54 EDT 2011


Author: dkuleshov
Date: 2011-08-19 08:24:53 -0400 (Fri, 19 Aug 2011)
New Revision: 4783

Modified:
   jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
   jcr/trunk/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl
Log:
EXOJCR-1379: fixed node's parent-href generatin in XSLT transformation

Modified: jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java	2011-08-19 11:58:14 UTC (rev 4782)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/CollectionResource.java	2011-08-19 12:24:53 UTC (rev 4783)
@@ -88,6 +88,11 @@
    final String XML_HREF = "xlink:href";
 
    /**
+    * XML parent href constant.
+    */
+   final static String XML_PARENT_HREF = "xlink:parent-href";
+
+   /**
     * XML namespace prefix.
     */
    final String PREFIX_XMLNS = "xmlns:sv";
@@ -428,6 +433,20 @@
                writer.writeAttribute(XLINK_XMLNS, XLINK_LINK);
                writer.writeAttribute(XML_NAME, node.getName());
                writer.writeAttribute(XML_HREF, rootHref + TextUtil.escape(node.getPath(), '%', true));
+
+
+               if (!node.getPath().equals("/"))
+               {
+                  // this is added to fix EXOJCR-1379
+                  // XSLT string operations with actual node href, (which are used during XSLT transformation
+                  // to receive parent href) produce wrong parent-href if node path containes non-latin symbols, 
+                  // so instead we simply add one more attribute which already contains parent-href
+                  // as result: no XLST processor string manipulation is needed
+                  String nodeParentHref = rootHref + TextUtil.escape(node.getParent().getPath(), '%', true);
+                  writer.writeAttribute(XML_PARENT_HREF, nodeParentHref);
+               }
+
+
                // add properties
                for (PropertyIterator pi = node.getProperties(); pi.hasNext();)
                {

Modified: jcr/trunk/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl
===================================================================
--- jcr/trunk/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl	2011-08-19 11:58:14 UTC (rev 4782)
+++ jcr/trunk/exo.jcr.component.webdav/src/main/resources/xslt/get-method.xsl	2011-08-19 12:24:53 UTC (rev 4783)
@@ -26,7 +26,7 @@
             <!-- Parent node link -->
             <a>
               <xsl:attribute name="href">
-                <xsl:value-of select="substring(./@xlink:href, 1, string-length(./@xlink:href) - string-length(./@sv:name))" />
+                <xsl:value-of select="./@xlink:parent-href" />
               </xsl:attribute>
               <xsl:if test="$folder-icon-path!=''">
                 <img src="{$folder-icon-path}" alt="" />



More information about the exo-jcr-commits mailing list