Lines 16-41
Link Here
|
16 |
limitations under the License. |
16 |
limitations under the License. |
17 |
--> |
17 |
--> |
18 |
|
18 |
|
|
|
19 |
<!-- |
20 |
The XHTML namespace is declared as the default namespace |
21 |
to cause the stylesheet to output XHTML using the empty string |
22 |
as namespace prefix (<html> instead of <xhtml:html>). |
23 |
--> |
24 |
|
19 |
<!-- $Id$ --> |
25 |
<!-- $Id$ --> |
20 |
|
26 |
<xsl:stylesheet version="1.0" |
21 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
27 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
|
28 |
xmlns="http://www.w3.org/1999/xhtml"> |
29 |
|
22 |
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> |
30 |
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> |
|
|
31 |
|
23 |
<xsl:template match="*"> |
32 |
<xsl:template match="*"> |
24 |
<!-- remove element prefix (if any) --> |
33 |
<xsl:element name="{local-name()}" namespace="{namespace-uri()}"> |
25 |
<xsl:element name="{local-name()}"> |
34 |
<xsl:copy-of select="@*"/> |
26 |
<!-- process attributes --> |
|
|
27 |
<xsl:for-each select="@*"> |
28 |
<!-- remove attribute prefix (if any) --> |
29 |
<xsl:attribute name="{local-name()}"> |
30 |
<xsl:value-of select="."/> |
31 |
</xsl:attribute> |
32 |
</xsl:for-each> |
33 |
<xsl:apply-templates/> |
35 |
<xsl:apply-templates/> |
34 |
</xsl:element> |
36 |
</xsl:element> |
35 |
</xsl:template> |
37 |
</xsl:template> |
36 |
|
38 |
|
|
|
39 |
<!-- fixme: this might be generalized to also pass on processing instructions etc...--> |
37 |
<xsl:template match="comment()"> |
40 |
<xsl:template match="comment()"> |
38 |
<xsl:copy/> |
41 |
<xsl:copy/> |
39 |
</xsl:template> |
42 |
</xsl:template> |
40 |
|
43 |
|
41 |
</xsl:stylesheet> |
44 |
<!-- |
|
|
45 |
Workaround to prevent the serializer from collapsing these |
46 |
elements, since browsers currently can not handle things like |
47 |
<textarea/> |
48 |
The XHTML serializer currently used by Lenya can not be |
49 |
configured to avoid this collapsing; as long as that is the case |
50 |
this workaround is needed. |
51 |
--> |
52 |
<xsl:template match="textarea|script|style"> |
53 |
<xsl:element name="{local-name()}"> |
54 |
<xsl:copy-of select="@*"/> |
55 |
<xsl:apply-templates/> |
56 |
<xsl:if test="string-length(.) = 0"><xsl:text> </xsl:text></xsl:if> |
57 |
</xsl:element> |
58 |
</xsl:template> |
59 |
</xsl:stylesheet> |