+<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
Dokument ten opisuje jednoznaczne przeksztaĆcenie WLML 0.1 -> XHTML.
-->
- <xsl:output method="xml" encoding="utf-8" indent="no" />
-
- <xsl:template match="/">
- <xsl:apply-templates select="chunk|utwor" />
- </xsl:template>
+ <xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" indent="no" />
<!--
Base tag for rendering a fragment of text
<xsl:template match="utwor">
<div>
<xsl:call-template name="standard-attributes" />
- <xsl:apply-templates select="child::*">
+ <xsl:apply-templates select="child::node()">
<xsl:with-param name="mixed" select="false()" />
</xsl:apply-templates>
</div>
-->
<xsl:template match="motto">
<xsl:param name="mixed" />
- <div>
+ <div x-editable="true">
<xsl:call-template name="standard-attributes" />
<xsl:apply-templates select="child::node()">
<xsl:with-param name="mixed" select="true()" />
<xsl:template match="didaskalia">
<xsl:param name="mixed" />
- <div>
+ <div x-editable="true">
<xsl:call-template name="standard-attributes" />
<xsl:apply-templates select="child::node()">
<xsl:with-param name="mixed" select="true()" />
<xsl:choose>
<!-- Simple verse == not wers_ tags anywhere until the ending br -->
<xsl:when test="not($verse-content[starts-with(name(), 'wers_')])">
- <p class="wers" x-node="wers">
+ <p class="wers" x-node="wers" x-verse="true">
<xsl:apply-templates select="$verse-content[local-name(.) != 'br']">
<xsl:with-param name="mixed" select="true()" />
</xsl:apply-templates>
<xsl:template match="wers_cd|wers_akap|wers_wciety">
<xsl:param name="mixed" />
- <p>
- <xsl:call-template name="standard-attributes" />
- <xsl:apply-templates select="child::node()">
- <xsl:with-param name="mixed" select="true()" />
- </xsl:apply-templates>
- </p>
+ <!-- <xsl:choose>
+ <xsl:when test="ancestor::*[0]/self::strofa"> -->
+ <p x-verse="true">
+ <xsl:call-template name="standard-attributes" />
+ <xsl:apply-templates select="child::node()">
+ <xsl:with-param name="mixed" select="true()" />
+ </xsl:apply-templates>
+ </p>
+ <!-- </xsl:when>
+ <xsl:choose> -->
</xsl:template>
<xsl:template match="br"><xsl:text>/</xsl:text></xsl:template>
<!-- the link to the non-inline version -->
<a href="#annotation-{generate-id(.)}" class="annotation"></a>
<!-- inline contents -->
- <span x-annotation-box="true">
+ <span x-annotation-box="true" x-pass-thru="true">
<xsl:call-template name="context-menu" />
<xsl:apply-templates select="node()">
<xsl:with-param name="mixed" select="true()" />
<xsl:template match="begin">
<span>
<xsl:call-template name="standard-attributes" />
+ <xsl:attribute name="theme-class">
+ <xsl:value-of select="substring-after(@id, 'b')" />
+ </xsl:attribute>
</span>
</xsl:template>
<xsl:template match="extra|uwaga">
<span>
<xsl:call-template name="standard-attributes" />
- <xsl:apply-templates select="node()" />
+ <xsl:apply-templates select="child::node()">
+ <xsl:with-param name="mixed" select="true()" />
+ </xsl:apply-templates>
</span>
</xsl:template>
<xsl:template match="motyw">
<span x-editable="true">
<xsl:call-template name="standard-attributes" />
+ <xsl:attribute name="theme-class">
+ <xsl:value-of select="substring-after(@id, 'm')" />
+ </xsl:attribute>
<xsl:call-template name="context-menu" />
- <xsl:value-of select="." />
+ <span x-pass-thru="true" class="theme-text-list"><xsl:value-of select=".|node()" /></span>
</span>
</xsl:template>
<xsl:template match="end">
<span>
- <xsl:call-template name="standard-attributes" />
+ <xsl:call-template name="standard-attributes" />
+ <xsl:attribute name="theme-class">
+ <xsl:value-of select="substring-after(@id, 'e')" />
+ </xsl:attribute>
</span>
</xsl:template>
-->
<xsl:template match="text()">
+ <!-- <xsl:value-of select="." /> -->
<xsl:param name="mixed" />
<xsl:choose>
<xsl:when test="normalize-space(.) = ''" />
- <xsl:when test="not($mixed)"><span x-node="out-of-flow-text" class="out-of-flow-text"
- x-content="{.}"></span></xsl:when>
+ <xsl:when test="not($mixed)">
+ <span x-node="out-of-flow-text" class="out-of-flow-text" x-editable="true">
+ <xsl:value-of select="." />
+ </span>
+ </xsl:when>
<xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:template>
<xsl:template match="*[name() != local-name()]">
- <div>
+ <span>
<xsl:call-template name="standard-attributes" />
<xsl:apply-templates select="child::node()">
<xsl:with-param name="mixed" select="true()" />
</xsl:apply-templates>
- </div>
+ </span>
</xsl:template>
+
+ <!--
+ Earlier versions of html2wl introduced a BUG, that 'causes "out-of-flow-text" tag to appear.
+ Instead of marking it as "unknown", just pass thru it
+ -->
+ <xsl:template match="out-of-flow-text">
+ <xsl:param name="mixed" />
+ <xsl:apply-templates select="child::node()">
+ <xsl:with-param name="mixed" select="$mixed" />
+ </xsl:apply-templates>
+ </xsl:template>
<xsl:template match="*">
- <xsl:message terminate="no">
- Unmatched tag <xsl:value-of select="name()" />
- </xsl:message>
+ <span class="unknown-tag" x-node="{name()}">
+ <xsl:apply-templates select="child::node()">
+ <xsl:with-param name="mixed" select="true()" />
+ </xsl:apply-templates>
+ </span>
</xsl:template>
<xsl:template name="context-menu">
- <span class="default-menu context-menu">
- <span class="edit-button">Edit</span>
- </span>
- <span class="edit-menu context-menu">
- <span class="accept-button">OK</span>
- <span class="reject-button">Cancel</span>
- </span>
+ <!-- <span class="default-menu context-menu"> -->
+ <!-- <button class="edit-button">Edytuj</button> -->
+ <!-- <span class="delete-button">Delete</span> -->
+ <!-- </span> -->
+ <!-- <span class="edit-menu context-menu">
+ <span class="accept-button">Accept</span>
+ <span class="reject-button">Close</span>
+ </span> -->
</xsl:template>
<xsl:template name="standard-attributes">
<xsl:param name="extra-class" />
<xsl:attribute name="class"><xsl:value-of select="local-name()" /><xsl:text> </xsl:text><xsl:value-of select="$extra-class" /></xsl:attribute>
- <!-- we use upper-case attribute names, so we don't have to wory about HTML parsers -->
- <xsl:attribute name="x-node"><xsl:value-of select="name()" /></xsl:attribute>
+ <xsl:attribute name="x-node"><xsl:value-of select="local-name()" /></xsl:attribute>
<xsl:if test="local-name() != name()">
<xsl:attribute name="x-ns"><xsl:value-of select="namespace-uri()" /></xsl:attribute>
<xsl:for-each select="@*">
<xsl:variable name="id" select="generate-id()" />
<xsl:attribute name="x-attr-value-{$id}"><xsl:value-of select="."/></xsl:attribute>
- <xsl:attribute name="x-attr-qname-{$id}"><xsl:value-of select="name()"/></xsl:attribute>
- <xsl:if test="namespace-uri()">
+ <xsl:attribute name="x-attr-name-{$id}"><xsl:value-of select="local-name()"/></xsl:attribute>
+ <xsl:choose>
+ <xsl:when test="namespace-uri()">
<xsl:attribute name="x-attr-ns-{$id}"><xsl:value-of select="namespace-uri()"/></xsl:attribute>
- </xsl:if>
+ </xsl:when>
+ <!-- if the element belongs to default namespace and attribut has no namespace -->
+ <xsl:when test="not(namespace-uri(.))">
+ <xsl:attribute name="data-wlf-{local-name()}"><xsl:value-of select="."/></xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
</xsl:for-each>
</xsl:template>