Annotation of kupu/apache-lenya/lenya/kupusave.xsl, revision 1.1.1.1
1.1 dwinter 1: <?xml version="1.0" encoding="UTF-8" ?>
2:
3: <!--
4: Merges lenya:meta into xhtml send by kupu for save.
5: We also remove some <link>s here i.e. for css and rel.
6: -->
7:
8: <xsl:stylesheet version="1.0"
9: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10: xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0"
11: xmlns:dc="http://purl.org/dc/elements/1.1/"
12: xmlns:dcterms="http://purl.org/dc/terms/"
13: xmlns="http://www.w3.org/1999/xhtml"
14: xmlns:xhtml="http://www.w3.org/1999/xhtml"
15: >
16:
17: <xsl:template match="edit-envelope">
18: <!--
19: FIXME: The _keepmes_ are needed for our incredible from(s) editor :)
20: I hope we can remove this someday.
21: -->
22: <html dc:dummy="FIXME:keepNamespace" dcterms:dummy="FIXME:keepNamespace" lenya:dummy="FIXME:keepNamespace" xhtml:dummy="FIXME:keepNamespace">
23: <xsl:copy-of select="original/xhtml:html/lenya:meta"/>
24: <head>
25: <xsl:apply-templates select="edited/xhtml:html/xhtml:head/xhtml:title"/>
26: <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
27: </head>
28: <xsl:apply-templates select="edited/xhtml:html/xhtml:body"/>
29: </html>
30: </xsl:template>
31:
32: <xsl:template match="xhtml:link"/>
33:
34: <!-- this template converts the img tag to object
35: for more, see http://www.xml.com/pub/a/2003/07/02/dive.html -->
36: <xsl:template match="xhtml:img">
37: <object>
38: <xsl:attribute name="data">
39: <!-- strip the nodeid out again (it is not saved in the object @data) -->
40: <xsl:choose>
41: <xsl:when test="starts-with(@src, '/')">
42: <xsl:value-of select="@src"/>
43: </xsl:when>
44: <xsl:otherwise>
45: <xsl:value-of select="substring-after(@src, '/')"/>
46: </xsl:otherwise>
47: </xsl:choose>
48: </xsl:attribute>
49: <xsl:attribute name="title">
50: <xsl:value-of select="@alt"/>
51: </xsl:attribute>
52: <!-- use the rarely-used ismap to roundtrip the type attribute for the object element -->
53: <xsl:attribute name="type">
54: <xsl:value-of select="@ismap"/>
55: </xsl:attribute>
56: <xsl:if test="string(@height)">
57: <xsl:attribute name="height">
58: <xsl:value-of select="@height"/>
59: </xsl:attribute>
60: </xsl:if>
61: <xsl:if test="string(@width)">
62: <xsl:attribute name="width">
63: <xsl:value-of select="@width"/>
64: </xsl:attribute>
65: </xsl:if>
66: </object>
67: </xsl:template>
68:
69: <!-- convert to semantic markup -->
70: <xsl:template match="xhtml:b">
71: <strong>
72: <xsl:apply-templates/>
73: </strong>
74: </xsl:template>
75:
76: <!-- convert to semantic markup -->
77: <xsl:template match="xhtml:i">
78: <em>
79: <xsl:apply-templates/>
80: </em>
81: </xsl:template>
82:
83: <!-- ignore these -->
84: <xsl:template match="@shape"/>
85: <xsl:template match="@align"/>
86: <xsl:template match="@name"/>
87: <xsl:template match="@type"/>
88: <xsl:template match="@style"/>
89: <xsl:template match="@start"/>
90: <xsl:template match="@clear"/>
91:
92: <!-- kupu seems to use those for hidden anchors, but does not get the nesting right. -->
93: <xsl:template match="a[@href = '']"/>
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>