document_content_service_default_xsl.html

 1   <?xml version="1.0"?>
 2   <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 3       <xsl:output method="html" indent="yes"/>
 4       <xsl:template match="document">
 5           <xsl:value-of select="document-title" />
 6   		<xsl:value-of select="document-summary" />
 7       </xsl:template>
 8       <xsl:template match="${document_type.code}">
 9           <p>            
 10               <strong><xsl:value-of select="document-title" /></strong>
 11           </p>
 12           <p>           
 13               <xsl:value-of select="document-summary" />
 14           </p>        
 15           <#list document_type.attributes as attribute>
 16           <p>
 17               <xsl:choose>
 18                   <xsl:when test="${document_type.code}-${attribute.code}/file-resource!=''">
 19                       <xsl:apply-templates select="${document_type.code}-${attribute.code}/file-resource" />
 20                   </xsl:when>
 21                   <xsl:otherwise>
 22                        <xsl:value-of disable-output-escaping="yes" select="${document_type.code}-${attribute.code}" />
 23                   </xsl:otherwise>
 24               </xsl:choose>
 25           </p>
 26           </#list>
 27       </xsl:template>
 28   
 29       <xsl:template match="file-resource">
 30           <xsl:choose>
 31               <xsl:when test="(resource-content-type='image/jpeg' or resource-content-type='image/jpg' or  resource-content-type='image/pjpeg' or resource-content-type='image/gif' or resource-content-type='image/png')">
 32                   <img src="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}" align="right" />
 33               </xsl:when>
 34               <xsl:when test="(resource-content-type='application/pdf')">
 35                   <a href="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}">
 36                       <img src="images/local/skin/plugins/document/filetypes/pdf.png" />
 37                   </a>
 38               </xsl:when>
 39               <xsl:when test="(resource-content-type='application/binary')">
 40                   <a href="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}">
 41                       <img src="images/local/skin/plugins/document/filetypes/compressed.png" />
 42                   </a>
 43               </xsl:when>
 44               <xsl:when test="(resource-content-type='video/mpeg')">
 45                   <a href="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}">
 46                       <img src="images/local/skin/plugins/document/filetypes/video.png" />
 47                   </a>
 48               </xsl:when>
 49               <xsl:when test="(resource-content-type='audio/mpeg')">
 50                   <a href="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}">
 51                       <img src="images/local/skin/plugins/document/filetypes/audio.png" />
 52                   </a>
 53               </xsl:when>
 54               <xsl:otherwise>
 55                   <a href="servlet/plugins/document/resource?id={resource-document-id}&amp;id_attribute={resource-attribute-id}">
 56                       <img src="images/local/skin/plugins/document/filetypes/file.png" />
 57                   </a>
 58               </xsl:otherwise>
 59           </xsl:choose>
 60       </xsl:template>
 61   
 62   </xsl:stylesheet>
 63