X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8705c980a8a35af6c4fc6e309f389bc1aae0b6d7..2a660ddc228d5dbc02514cc5cc5a5d0e36b0a799:/platforma/static/xsl/wl2html_client.xsl?ds=inline diff --git a/platforma/static/xsl/wl2html_client.xsl b/platforma/static/xsl/wl2html_client.xsl old mode 100755 new mode 100644 index 85ff4a38..a5db5a1c --- a/platforma/static/xsl/wl2html_client.xsl +++ b/platforma/static/xsl/wl2html_client.xsl @@ -1,3 +1,4 @@ +<?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"> @@ -5,11 +6,7 @@ <!-- Dokument ten opisuje jednoznaczne przeksztaÅcenie WLML 0.1 -> XHTML. --> - <xsl:output method="html" encoding="utf-8" indent="yes" /> - - <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 @@ -24,9 +21,14 @@ Base tag for rendering the whole text --> - <!-- TODO --> - - + <xsl:template match="utwor"> + <div> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="false()" /> + </xsl:apply-templates> + </div> + </xsl:template> <!-- PrzeksztaÅcenia poszczególnych elementów zgodnie z: @@ -38,9 +40,40 @@ Tagi rozpoczynajÄ ce i koÅczÄ ce tekst utworu lirycznego o standardowej szerokoÅci Åamu: --> - <xsl:template match="liryka_l"> + <xsl:template match="opowiadanie|powiesc"> + <xsl:param name="mixed" /> + <div> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="false()" /> + </xsl:apply-templates> + </div> + </xsl:template> + + <xsl:template match="liryka_l|liryka_lp"> + <xsl:param name="mixed" /> + <div> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="false()" /> + </xsl:apply-templates> + </div> + </xsl:template> + + <xsl:template match="dramat_wierszowany_l|dramat_wierszowany_lp|dramat_wspolczesny"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="false()" /> + </xsl:apply-templates> + </div> + </xsl:template> + + <xsl:template match="wywiad"> + <xsl:param name="mixed" /> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -63,7 +96,9 @@ --> <xsl:template match="autor_utworu"> <xsl:param name="mixed" /> - <h2 class="{name()}" x-editable="true" x-node="{name()}"> + <h2 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -80,7 +115,9 @@ --> <xsl:template match="nazwa_utworu"> <xsl:param name="mixed" /> - <h1 class="{name()}" x-editable="true" x-node="{name()}"> + <h1 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -102,7 +139,9 @@ --> <xsl:template match="dzielo_nadrzedne"> <xsl:param name="mixed" /> - <h2 class="{name()}" x-editable="true" x-node="{name()}"> + <h2 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -125,7 +164,9 @@ --> <xsl:template match="podtytul"> <xsl:param name="mixed" /> - <h3 class="{name()}" x-editable="true" x-node="{name()}"> + <h3 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -140,7 +181,8 @@ <xsl:template match="nota"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -153,7 +195,8 @@ --> <xsl:template match="dedykacja"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -166,16 +209,19 @@ --> <xsl:template match="motto"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div x-editable="true"> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> - <xsl:with-param name="mixed" select="false()" /> + <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> </div> </xsl:template> <xsl:template match="motto_podpis"> <xsl:param name="mixed" /> - <p class="{name()}" x-editable="true" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -190,7 +236,8 @@ --> <xsl:template match="lista_osob"> <xsl:param name="mixed" /> - <div class="{name()}" x-editable="true" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -199,7 +246,9 @@ <xsl:template match="naglowek_listy"> <xsl:param name="mixed" /> - <p class="{name()}" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -208,7 +257,25 @@ <xsl:template match="lista_osoba"> <xsl:param name="mixed" /> - <p class="{name()}" x-editable="true" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="true()" /> + </xsl:apply-templates> + </p> + </xsl:template> + + <!-- Tagi obejmujÄ ce inne komentarze wprowadzajÄ ce + przed tekstem dramatu (skÅadane razem z listÄ osób): + + <miejsce_czas> komentarze-wprowadzajÄ ce </miejsce_czas> + --> + <xsl:template match="miejsce_czas"> + <xsl:param name="mixed" /> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -228,7 +295,9 @@ --> <xsl:template match="naglowek_czesc"> <xsl:param name="mixed" /> - <h2 class="{name()}" x-editable="true" x-node="{name()}"> + <h2 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -241,7 +310,9 @@ --> <xsl:template match="naglowek_rozdzial"> <xsl:param name="mixed" /> - <h3 class="{name()}" x-editable="true" x-node="{name()}"> + <h3 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -254,7 +325,9 @@ --> <xsl:template match="naglowek_podrozdzial"> <xsl:param name="mixed" /> - <h4 class="{name()}" x-editable="true" x-node="{name()}"> + <h4 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -271,7 +344,9 @@ <xsl:template match="srodtytul"> <xsl:param name="mixed" /> - <h2 class="{name()}" x-editable="true" x-node="{name()}"> + <h2 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -280,7 +355,9 @@ <xsl:template match="naglowek_akt"> <xsl:param name="mixed" /> - <h2 class="{name()}" x-editable="true" x-node="{name()}"> + <h2 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -294,7 +371,9 @@ <xsl:template match="naglowek_scena"> <xsl:param name="mixed" /> - <h3 class="{name()}" x-editable="true" x-node="{name()}"> + <h3 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -303,7 +382,9 @@ <xsl:template match="naglowek_osoba"> <xsl:param name="mixed" /> - <h4 class="{name()}" x-editable="true" x-node="{name()}"> + <h4 x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -318,7 +399,8 @@ <xsl:template match="dlugi_cytat"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -327,7 +409,8 @@ <xsl:template match="poezja_cyt"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -336,7 +419,8 @@ <xsl:template match="kwestia"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -345,16 +429,18 @@ <xsl:template match="didaskalia"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div x-editable="true"> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> - <xsl:with-param name="mixed" select="false()" /> + <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> </div> </xsl:template> <xsl:template match="wywiad_pyt"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -363,7 +449,8 @@ <xsl:template match="wywiad_odp"> <xsl:param name="mixed" /> - <div class="{name()}" x-node="{name()}"> + <div> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="false()" /> </xsl:apply-templates> @@ -378,7 +465,9 @@ <xsl:template match="akap"> <xsl:param name="mixed" /> - <p class="{name()}" x-editable="true" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -387,7 +476,9 @@ <xsl:template match="akap_cd"> <xsl:param name="mixed" /> - <p class="{name()}" x-editable="true" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -396,7 +487,9 @@ <xsl:template match="akap_dialog"> <xsl:param name="mixed" /> - <p class="{name()}" x-editable="true" x-node="{name()}"> + <p x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -409,28 +502,29 @@ ******** --> <xsl:template match="strofa"> - <div class="{name()}" x-editable="true" x-node="{name()}"> + <div x-editable="true"> + <xsl:call-template name="standard-attributes" /> + <xsl:call-template name="context-menu" /> + <xsl:choose> <xsl:when test="count(br) > 0"> + <xsl:variable name="first-verse" select="br[1]/preceding-sibling::node()" /> <xsl:call-template name="verse"> - <xsl:with-param name="verse-content" select="br[1]/preceding-sibling::node()" /> - <xsl:with-param name="verse-type" select="name(br[1]/preceding-sibling::*[starts-with(name(current()),'wers')])" /> + <xsl:with-param name="verse-content" select="$first-verse" /> </xsl:call-template> <xsl:for-each select="br"> - <!-- Each BR tag "consumes" text after it --> <xsl:variable name="lnum" select="count(preceding-sibling::br)" /> + <!-- select all nodes up to the next br or end of stanza --> + <xsl:variable name="current-verse" + select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" /> <xsl:call-template name="verse"> - <xsl:with-param name="verse-content" - select="following-sibling::node()[count(preceding-sibling::br) = $lnum+1]" /> - <xsl:with-param name="verse-type" - select="name(following-sibling::*[count(preceding-sibling::br) = $lnum+1 and starts-with(name(current()), 'wers')][1])" /> + <xsl:with-param name="verse-content" select="$current-verse" /> </xsl:call-template> </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:call-template name="verse"> - <xsl:with-param name="verse-content" select="child::node()" /> - <xsl:with-param name="verse-type" select="name(child::*[starts-with(name(current()),'wers')])" /> + <xsl:with-param name="verse-content" select="child::node()" /> </xsl:call-template> </xsl:otherwise> </xsl:choose> @@ -438,33 +532,47 @@ </xsl:template> <xsl:template name="verse"> + <!-- the verse contents including the last br (if any) --> <xsl:param name="verse-content" /> - <xsl:param name="verse-type" /> + <xsl:variable name="first-tag-name" select="name($verse-content/self::*)" /> + <!-- name of text nodes is '' == false --> + <!-- THIS IS A HORROR!!! --> + <!-- Possible variants: --> <xsl:choose> - <xsl:when test="$verse-type = ''"> - <p class="wers" x-node="wers"> - <xsl:for-each select="$verse-content[name(.) != 'br']"> - <xsl:apply-templates select="."> - <xsl:with-param name="mixed" select="true()" /> - </xsl:apply-templates> - </xsl:for-each> - </p> - </xsl:when> - <xsl:otherwise> - <p class="{$verse-type}" x-node="{$verse-type}"> - <xsl:for-each select="$verse-content[name(.) != 'br']"> - <xsl:apply-templates select="."> + <!-- 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" x-verse="true"> + <xsl:apply-templates select="$verse-content[local-name(.) != 'br']"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> - </xsl:for-each> </p> + </xsl:when> + + <xsl:otherwise> + <xsl:apply-templates select="$verse-content[local-name(.) != 'br']"> + <xsl:with-param name="mixed" select="false()" /> + </xsl:apply-templates> </xsl:otherwise> </xsl:choose> - - </xsl:template> - + + <xsl:template match="wers_cd|wers_akap|wers_wciety"> + <xsl:param name="mixed" /> + <!-- <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> + <!-- ************* @@ -480,16 +588,18 @@ --> <xsl:template match="tytul_dziela"> <xsl:param name="mixed" /> - <span class="{name()}" x-editable="true" x-node="{name()}"> + <em> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> - </span> + </em> </xsl:template> <xsl:template match="wyroznienie|slowo_obce|mat|didask_tekst|osoba|wyp_osoba|www"> <xsl:param name="mixed" /> - <em class="{name()}" x-node="{name()}"> + <em> + <xsl:call-template name="standard-attributes" /> <xsl:apply-templates select="child::node()"> <xsl:with-param name="mixed" select="true()" /> </xsl:apply-templates> @@ -503,22 +613,22 @@ --> <xsl:template match="sekcja_swiatlo"> <xsl:param name="mixed" /> - <br class="{name()}" x-node="{name()}" /> + <br><xsl:call-template name="standard-attributes" /></br> </xsl:template> - <xsl:template match="sekcja_asteryks"> + <xsl:template match="sekcja_asterysk"> <xsl:param name="mixed" /> - <hr class="{name()}" x-node="{name()}" /> + <hr><xsl:call-template name="standard-attributes" /></hr> </xsl:template> <xsl:template match="separator_linia"> <xsl:param name="mixed" /> - <hr class="{name()}" x-node="{name()}" /> + <hr><xsl:call-template name="standard-attributes" /></hr> </xsl:template> <xsl:template match="zastepnik_wersu"> <xsl:param name="mixed" /> - <hr class="{name()}" x-node="{name()}" /> + <hr><xsl:call-template name="standard-attributes" /></hr> </xsl:template> <!-- @@ -531,35 +641,58 @@ Przypisy i motywy --> <xsl:template match="pr|pa|pe|pt"> - <span class="annotation-inline-box" x-node="{name()}"> + <span x-editable="true" x-common="common"> + <xsl:call-template name="standard-attributes"> + <xsl:with-param name="extra-class" select="'annotation-inline-box'" /> + </xsl:call-template> <a name="anchor-{generate-id(.)}" /> <!-- 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:apply-templates> </span> </span> + </xsl:template> + <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="begin"> - <xsl:variable name="id" select="substring-after(@id, 'b')" /> - <span class="theme-begin" x-node="begin" x-theme-class="{$id}" id="{@id}"></span> - <xsl:apply-templates select="following-sibling::motyw[@id = concat('m', $id)]" mode="theme-begin" /> + <xsl:template match="extra|uwaga"> + <span x-common="common"> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="true()" /> + </xsl:apply-templates> + </span> </xsl:template> <xsl:template match="motyw"> - <span class="theme-ref" x-node="motyw" x-theme-class="{substring-after(@id, 'm')}" id="{@id}"> - <xsl:value-of select="." /> + <span x-editable="true" x-common="common"> + <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" /> + <span x-pass-thru="true" class="theme-text-list"><xsl:value-of select=".|node()" /></span> </span> </xsl:template> - <xsl:template match="end"> - <span class="theme-end" x-node="end" x-theme-class="{substring-after(@id, 'e')}" id="{@id}"> + <span> + <xsl:call-template name="standard-attributes" /> + <xsl:attribute name="theme-class"> + <xsl:value-of select="substring-after(@id, 'e')" /> + </xsl:attribute> </span> </xsl:template> @@ -571,21 +704,86 @@ --> <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="text" class="out-of-flow-text" - x-content="{normalize-space(.)}"></span> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="." /> - </xsl:otherwise> + <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 match="comment()"> + <xsl:comment><xsl:value-of select="." /></xsl:comment> + </xsl:template> + + <xsl:template match="*[name() != local-name()]"> + <span> + <xsl:call-template name="standard-attributes" /> + <xsl:apply-templates select="child::node()"> + <xsl:with-param name="mixed" select="true()" /> + </xsl:apply-templates> + </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="*"> - <div x-node="error" x-content="{name()}" /> + <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"> --> + <!-- <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> + + <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:if> + + <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-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: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> </xsl:stylesheet> \ No newline at end of file