Annotation of kupuMPIWG/apache-lenya/lenya/content2edit.xsl, revision 1.1.1.1

1.1       dwinter     1: <?xml version="1.0" encoding="UTF-8" ?>
                      2: 
                      3: <!--
                      4:   Transforms page to be edited by Kupu wysiwyg xhtml editor.
                      5:   Here the link to css etc. is inserted and marked(see lenyacontent attribute) 
                      6:   to be remved when saved.
                      7: -->
                      8: 
                      9: <xsl:stylesheet version="1.0"
                     10:   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                     11:   xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
                     12:   xmlns:xhtml="http://www.w3.org/1999/xhtml"
                     13:     xmlns:dc="http://purl.org/dc/elements/1.1/"
                     14:   xmlns="http://www.w3.org/1999/xhtml"
                     15:  >
                     16: 
                     17: <xsl:param name="css"/>
                     18: <xsl:param name="nodeid"/>
                     19: 
                     20: <xsl:template match="lenya:meta"/>
                     21: 
                     22: <xsl:template match="xhtml:head">
                     23:   <head>
                     24:     <xsl:apply-templates/> 
                     25:     <link rel="stylesheet" href="{$css}" mime-type="text/css" />
                     26:     <!-- 
                     27:       Fix for IE: Special characters e.g. german umlauts are displayed correct in the document being edited.
                     28:       NOTE: This should normally be done by the serialization, 
                     29:       but it doen't work in case of usecase=kupu step=content.
                     30:     -->
                     31:     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
                     32:   </head>
                     33: </xsl:template>
                     34: 
                     35:    <!-- this template converts the object tag to img (for compatiblity with older browsers 
                     36:     for more, see http://www.xml.com/pub/a/2003/07/02/dive.html -->
                     37:    <xsl:template name="object2img">
                     38:       <img border="0">
                     39:         <xsl:attribute name="src">
                     40:           <xsl:choose>
                     41:             <xsl:when test="not(starts-with(@data, '/'))">
                     42:               <xsl:value-of select="$nodeid"/>/<xsl:value-of select="@data"/>
                     43:             </xsl:when>
                     44:             <xsl:otherwise>            
                     45:               <xsl:value-of select="@data"/>
                     46:             </xsl:otherwise>
                     47:           </xsl:choose>
                     48:         </xsl:attribute>
                     49:         <!-- use the rarely-used ismap to roundtrip the type attribute for the object element -->
                     50:         <xsl:attribute name="ismap">
                     51:           <xsl:value-of select="@type"/>
                     52:         </xsl:attribute>
                     53:         <xsl:attribute name="alt">
                     54:           <!-- the overwritten title (stored in @name) has precedence over dc:title -->
                     55:           <xsl:choose>
                     56:             <xsl:when test="@name != ''">
                     57:               <xsl:value-of select="@name"/>
                     58:             </xsl:when>
                     59:             <xsl:otherwise>
                     60:               <xsl:value-of select="dc:metadata/dc:title"/>                    
                     61:             </xsl:otherwise>
                     62:             </xsl:choose>
                     63:         </xsl:attribute>
                     64:          <xsl:if test="string(@height)">
                     65:           <xsl:attribute name="height">
                     66:             <xsl:value-of select="@height"/>
                     67:           </xsl:attribute>
                     68:         </xsl:if> 
                     69:         <xsl:if test="string(@width)">
                     70:           <xsl:attribute name="width">
                     71:             <xsl:value-of select="@width"/>
                     72:           </xsl:attribute>
                     73:         </xsl:if>         
                     74:       </img>
                     75:    </xsl:template>
                     76:   
                     77:   <xsl:template match="xhtml:object" priority="3">
                     78:     <xsl:choose>
                     79:       <xsl:when test="@href != ''">
                     80:         <a href="{@href}">
                     81:           <xsl:call-template name="object2img"/>
                     82:         </a>
                     83:       </xsl:when>
                     84:       <xsl:when test="@type = 'application/x-shockwave-flash'">
                     85:         <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
                     86:             <param name="movie" value="{$nodeid}/{@data}"/>
                     87:         </object>
                     88:       </xsl:when>
                     89:       <xsl:otherwise>
                     90:         <xsl:call-template name="object2img"/>
                     91:       </xsl:otherwise>
                     92:     </xsl:choose>
                     93:   </xsl:template>  
                     94: 
                     95: <xsl:template match="@*|node()">
                     96:   <xsl:copy>
                     97:     <xsl:apply-templates select="@*|node()"/>
                     98:   </xsl:copy>
                     99: </xsl:template> 
                    100: 
                    101: </xsl:stylesheet>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>