jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r762778 - in /jackrabbit/sandbox/docview-xslt: ./ README.txt jcr-docview-pretty-print.xslt
Date Wed, 08 Apr 2009 04:10:57 GMT
Author: jukka
Date: Tue Apr  7 13:54:14 2009
New Revision: 762778

URL: http://svn.apache.org/viewvc?rev=762778&view=rev
Log:
JCR-1132: XSLT pretty-printer for JCR document view export files

Added the docview pretty printer XSLT in the sandbox.

Added:
    jackrabbit/sandbox/docview-xslt/
    jackrabbit/sandbox/docview-xslt/README.txt   (with props)
    jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt   (with props)

Added: jackrabbit/sandbox/docview-xslt/README.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/docview-xslt/README.txt?rev=762778&view=auto
==============================================================================
--- jackrabbit/sandbox/docview-xslt/README.txt (added)
+++ jackrabbit/sandbox/docview-xslt/README.txt Tue Apr  7 13:54:14 2009
@@ -0,0 +1,2 @@
+XSLT pretty-printer for JCR document view export files
+from https://issues.apache.org/jira/browse/JCR-1132

Propchange: jackrabbit/sandbox/docview-xslt/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt?rev=762778&view=auto
==============================================================================
--- jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt (added)
+++ jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt Tue Apr  7 13:54:14 2009
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Pretty-printer for JCR document view export files.
+  
+  Generates an HTML document meant to document a subtree,
+  for training or documentation purposes. 
+-->
+
+<xsl:transform
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:jcr="http://www.jcp.org/jcr/1.0"
+  version="1.0">
+  
+  <xsl:variable name="rootElementName">
+    <xsl:for-each select="/*">
+      <xsl:value-of select="name()"/>
+    </xsl:for-each>
+  </xsl:variable>
+  <xsl:variable name="title" select="concat('JCR repository dump: ', $rootElementName)"/>
+  
+  <xsl:output method="html" encoding="UTF-8"/>
+
+  <xsl:template match="/">
+    <html>
+      <head>
+        <title><xsl:value-of select="$title"/></title>
+        <xsl:call-template name="css"/> 
+      </head>      
+      <body>
+        <h1><xsl:value-of select="$title"/></h1>
+        <xsl:apply-templates/>
+        <div class="footer"/>
+      </body>
+    </html>
+  </xsl:template>
+  
+  <xsl:template match="*">
+    <div class="element">
+      <div class="header">
+        <span class="elementName"><xsl:value-of select="name()"/></span>
+        <span class="nodeType">
+            <xsl:value-of select="@jcr:primaryType"/>
+            <xsl:if test="@jcr:uuid">
+              &#160;&#160;&#160;&#160;<span class="uuid"><xsl:value-of
select="@jcr:uuid"/></span>
+            </xsl:if>
+        </span>
+      </div>
+      <xsl:if test="@*">
+        <div class="properties">
+          <table>
+            <xsl:apply-templates select="@*[not(name() = 'jcr:uuid' or name() = 'jcr:primaryType')]">
+              <xsl:sort select="name()"/>
+            </xsl:apply-templates>
+          </table>
+        </div>
+      </xsl:if>
+      <xsl:apply-templates/>
+    </div>
+  </xsl:template>
+  
+  <xsl:template match="@*">
+    <xsl:variable name="tooMuchText" select="string-length(.) &gt; 80"/>
+    <xsl:variable name="value">
+      <xsl:choose>
+        <xsl:when test="$tooMuchText">
+          <xsl:value-of select="substring(.,1,80)"/>...
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="."/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+    
+    <tr class="property">
+      <div class="{translate(name(),':','_')}">
+        <td class="propertyName"><xsl:value-of select="name()"/>:</td>
+        <td class="value"><xsl:value-of select="$value"/></td>
+      </div>
+    </tr>
+  </xsl:template>
+  
+  <xsl:template name="css">
+    <style type="text/css">
+      body {
+        font-family: "Lucida Grande";
+      }
+      tr {
+        vertical-align: bottom;
+      }
+      td .propertyName {
+        border: solid red 1px;
+        text-align: right;
+      }
+      .element {
+        margin-top: 1em;
+        margin-left: 1em;
+        border-left: solid blue 1px;
+        padding-left: 0.5em;
+      }
+      .elementName {
+        color:blue;
+        font-weight:bold;
+      }
+      .element .nodeType {
+        font-size:90%;
+        margin-left: 4em;
+        color:gray;
+      }
+      .properties {
+        color:black;
+        margin-left: 2em;
+        border-left: solid gray 1px;
+      }
+      .propertyName {
+        font-size:90%;
+      }
+      .property .value {
+        color:blue;
+        padding-left: 1em;
+      }
+      .uuid {
+        color:gray;
+        font-size:90%;
+      }
+      .nodeType {
+        margin-left: 1em;
+      }
+      h1 {
+        border-bottom: solid gray 1px;
+      }
+      .footer {
+        border-top: solid gray 1px;
+      }
+    </style>
+  </xsl:template>
+  
+</xsl:transform>
+

Propchange: jackrabbit/sandbox/docview-xslt/jcr-docview-pretty-print.xslt
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message