added test for language attribute which previously triggered a memory leak
authorWilliam M. Brack <wbrack@src.gnome.org>
Wed, 25 Feb 2004 09:13:20 +0000 (09:13 +0000)
committerWilliam M. Brack <wbrack@src.gnome.org>
Wed, 25 Feb 2004 09:13:20 +0000 (09:13 +0000)
* tests/general/Makefile.am, tests/general/bug-142.xsl,
  tests/general/bug-142.out, tests/docs/Makefile.am,
  tests/general/bug-142.xml: added test for language
  attribute which previously triggered a memory leak
  (from list report by Mike Hommey)

ChangeLog
tests/docs/Makefile.am
tests/docs/bug-142.xml [new file with mode: 0755]
tests/general/Makefile.am
tests/general/bug-142.out [new file with mode: 0644]
tests/general/bug-142.xsl [new file with mode: 0755]

index 2418d67..0bdc6a0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Feb 25 17:02:22 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+       * tests/general/Makefile.am, tests/general/bug-142.xsl,
+         tests/general/bug-142.out, tests/docs/Makefile.am,
+         tests/general/bug-142.xml: added test for language
+         attribute which previously triggered a memory leak
+         (from list report by Mike Hommey)
+
 Mon Feb 23 18:01:44 CET 2004 Daniel Veillard <daniel@veillard.com>
 
        * NEWS configure.in doc/*: preparing release 1.1.4, updated and
index 467bd50..cabb007 100644 (file)
@@ -141,6 +141,7 @@ EXTRA_DIST =        \
        bug-139.xml \
        bug-140.xml \
        bug-141.xml \
+       bug-142.xml \
        character.xml \
        array.xml \
        items.xml
diff --git a/tests/docs/bug-142.xml b/tests/docs/bug-142.xml
new file mode 100755 (executable)
index 0000000..295bb03
--- /dev/null
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<posts xmlns:日本語="http://glandium.org/nihongo/" xmlns="http://glandium.org/" xml:lang="fr">
+  <post xml:lang="ja" id="6">
+    <title 日本語:翻訳="Un autre message en japonais" 日本語:読方="ほかのにほんごのでんごん">他の日本語の伝言</title>
+    <date weekday="0">20040126</date>
+    <section>ウェブサイト</section>
+    <content>
+      <para 日本語:翻訳="Ce message est écrit en japonais et a une traduction" 日本語:読方="このでんごんはにほんごでかいて、ほんやくがある">この伝言は日本語で書いて、翻訳がある。<span xml:lang="fr">couhin ?</span></para>
+      <para xml:lang="fr">Et on a une petite phrase en français.</para>
+    </content>
+  </post>
+  <post id="5">
+    <title>Test</title>
+  </post>
+  <post xml:lang="ja" id="4">
+    <title>日本語の伝言</title>
+    <date weekday="0">20040125</date>
+    <section>ウェブサイト</section>
+    <content>
+      <para>この伝言は日本語で書いて、翻訳がない。<span 日本語:翻訳="En fait, juste un peu (et c'est une erreur)" 日本語:読方="じつはすこしだけ">実は少しだけ</span>。</para>
+      <para>あいうえおかきくけこさしすせそ…</para>
+    </content>
+  </post>
+  <post id="3">
+    <date weekday="5">20050812</date>
+  </post>
+  <post id="2">
+    <!-- Titre d'un post qui n'est pas en japonais non traduit ? -> erreur ! -->
+    <title>間違い</title>
+    <date weekday="0">20040125</date>
+    <section>部門は間違い</section>
+    <content>
+      <para>Quelques <item href="plop">tests</item> d'erreurs :</para>
+      <list>
+       <para>Un paragraphe dans la liste</para>
+       <item href="http://www.google.com/">un lien externe sans hreflang,</item>
+       <item></item>
+       <item><span><list><item>un couac</item></list></span>,</item>
+       <item><para><list><item>un autre</item></list></para>,</item>
+       <item>une <span 日本語:翻訳="traduction">翻訳</span> sans xml:lang="ja"</item>
+       <item xml:lang="ja" 日本語:翻訳="une date dans un bloc traduit"><date>20040125</date></item>
+      </list>
+    </content>
+  </post>
+  <post id="1">
+    <title xml:lang="ja">サンプル</title>
+    <date weekday="0">20040125</date>
+    <section xml:lang="ja">ウェブサイト</section>
+    <content>
+      <para>Ceci est un <span xml:lang="ja" 日本語:翻訳="test" 日本語:読方="てすと">テスト</span>.</para>
+      <list>
+       <item>Voici une liste,</item>
+       <item>un splendide test de <span href="http://www.google.com/" hreflang="en">lien extérieur</span>,</item>
+       <item>un autre test de lien, mais <span href="glandium.png">interne, cette fois</span>,</item>
+       <item xml:lang="ja" 日本語:翻訳="Item en japonais" 日本語:読方="にほんごのあいてむ">日本語のアイテム、</item>
+       <item xml:lang="ja" href="http://www.google.com" 日本語:翻訳="Item en japonais avec un lien" 日本語:読方="リンクがあるにほんごのあいてむ">リンクがある日本語のアイテム、</item>
+       <item href="http://www.google.com" hreflang="en">un item lien.</item>
+       <item>Un <span xml:lang="ja">テスト</span> d'auto-traduction (le mot est présent plus haut dans le post, pas la peine de tout répéter...</item>
+       <item>une date en ligne : <date weekday="1">20040301</date> et <list><item>une liste dans la liste</item></list></item>
+       <item>un <span href="glandium.png">lien avec du <span xml:lang="ja" 日本語:翻訳="japonais" 日本語:読方="にほんご">日本語</span> dedans</span></item>
+      </list>
+      <para href="http://www.google.com" hreflang="en">un paragraphe lien.</para>
+    </content>
+  </post>
+</posts>
index 64f6a99..6199da9 100644 (file)
@@ -147,6 +147,7 @@ EXTRA_DIST = \
     bug-139.out bug-139.xsl \
     bug-140.out bug-140.xsl \
     bug-141.out bug-141.xsl \
+    bug-142.out bug-142.xsl \
     character.out character.xsl \
     character2.out character2.xsl \
     itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-142.out b/tests/general/bug-142.out
new file mode 100644 (file)
index 0000000..6d71a1a
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr"><body><div id="post6" xml:lang="ja"><h3><a href="2004/01/26/6">&#x4ED6;&#x306E;&#x65E5;&#x672C;&#x8A9E;&#x306E;&#x4F1D;&#x8A00;</a></h3>
+      <p>&#x3053;&#x306E;&#x4F1D;&#x8A00;&#x306F;&#x65E5;&#x672C;&#x8A9E;&#x3067;&#x66F8;&#x3044;&#x3066;&#x3001;&#x7FFB;&#x8A33;&#x304C;&#x3042;&#x308B;&#x3002;<span xml:lang="fr">couhin ?</span></p>
+      <p>Et on a une petite phrase en fran&#xE7;ais.</p>
+    </div>
+    Test
+  <div id="post4" xml:lang="ja"><h3><a href="2004/01/25/4">&#x65E5;&#x672C;&#x8A9E;&#x306E;&#x4F1D;&#x8A00;</a></h3>
+      <p>&#x3053;&#x306E;&#x4F1D;&#x8A00;&#x306F;&#x65E5;&#x672C;&#x8A9E;&#x3067;&#x66F8;&#x3044;&#x3066;&#x3001;&#x7FFB;&#x8A33;&#x304C;&#x306A;&#x3044;&#x3002;&#x5B9F;&#x306F;&#x5C11;&#x3057;&#x3060;&#x3051;&#x3002;</p>
+      <p>&#x3042;&#x3044;&#x3046;&#x3048;&#x304A;&#x304B;&#x304D;&#x304F;&#x3051;&#x3053;&#x3055;&#x3057;&#x3059;&#x305B;&#x305D;&#x2026;</p>
+    </div><div id="post3" xml:lang="ja"><h3><a href="2005/08/12/3"/></h3></div><div id="post2" xml:lang="ja"><h3><a href="2004/01/25/2">&#x9593;&#x9055;&#x3044;</a></h3>
+      <p>Quelques tests d'erreurs :</p>
+      <ul>
+       Un paragraphe dans la liste
+       <li><a href="http://www.google.com/">un lien externe sans hreflang,</a></li>
+       <li/>
+       <li><span xml:lang="fr"><li>un couac</li></span>,</li>
+       <li><li>un autre</li>,</li>
+       <li>une <span xml:lang="fr">&#x7FFB;&#x8A33;</span> sans xml:lang="ja"</li>
+       <li>20040125</li>
+      </ul>
+    </div><div id="post1" xml:lang="ja"><h3><a href="2004/01/25/1">&#x30B5;&#x30F3;&#x30D7;&#x30EB;</a></h3>
+      <p>Ceci est un <span xml:lang="ja">&#x30C6;&#x30B9;&#x30C8;</span>.</p>
+      <ul>
+       <li>Voici une liste,</li>
+       <li>un splendide test de <a href="http://www.google.com/">lien ext&#xE9;rieur</a>,</li>
+       <li>un autre test de lien, mais <a href="glandium.png">interne, cette fois</a>,</li>
+       <li>&#x65E5;&#x672C;&#x8A9E;&#x306E;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x3001;</li>
+       <li><a href="http://www.google.com">&#x30EA;&#x30F3;&#x30AF;&#x304C;&#x3042;&#x308B;&#x65E5;&#x672C;&#x8A9E;&#x306E;&#x30A2;&#x30A4;&#x30C6;&#x30E0;&#x3001;</a></li>
+       <li><a href="http://www.google.com">un item lien.</a></li>
+       <li>Un <span xml:lang="ja">&#x30C6;&#x30B9;&#x30C8;</span> d'auto-traduction (le mot est pr&#xE9;sent plus haut dans le post, pas la peine de tout r&#xE9;p&#xE9;ter...</li>
+       <li>une date en ligne : 20040301 et <ul><li>une liste dans la liste</li></ul></li>
+       <li>un <a href="glandium.png">lien avec du <span xml:lang="ja">&#x65E5;&#x672C;&#x8A9E;</span> dedans</a></li>
+      </ul>
+      <p><a href="http://www.google.com">un paragraphe lien.</a></p>
+    </div></body></html>
diff --git a/tests/general/bug-142.xsl b/tests/general/bug-142.xsl
new file mode 100755 (executable)
index 0000000..8e1a6ac
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:g="http://glandium.org/" xmlns:日本語="http://glandium.org/nihongo/" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="g 日本語 date">
+
+  <xsl:template match="g:posts">
+    <html xml:lang="fr">
+      <body>
+        <xsl:apply-templates select="*"/>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="g:posts/g:post[g:date]">
+    <xsl:variable name="id" select="@id"/>
+    <xsl:variable name="date" select="concat(substring(g:date,1,4),'/',substring(g:date,5,2),'/',substring(g:date,7,2))"/>
+
+    <div id="post{$id}">
+      <xsl:if test="lang(ja)">
+        <xsl:attribute name="xml:lang">ja</xsl:attribute>
+      </xsl:if>
+      <h3><a href="{$date}/{$id}">
+        <xsl:apply-templates select="g:title"/>
+      </a></h3>
+      <xsl:apply-templates select="g:content"/>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="g:post/g:title">
+    <xsl:apply-templates mode="日本語" select="."/>
+  </xsl:template>
+
+  <xsl:template match="g:post/g:content">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="g:content/g:para">
+    <p><xsl:apply-templates mode="link" select="."/></p>
+  </xsl:template>
+
+  <xsl:template match="g:para/g:span|g:item/g:span|g:span/g:span">
+    <xsl:apply-templates mode="link" select="."/>
+  </xsl:template>
+
+  <xsl:template match="g:content/g:list|g:item/g:list">
+    <ul><xsl:apply-templates mode="link" select="."/></ul>
+  </xsl:template>
+
+  <xsl:template match="g:list/g:item">
+    <li><xsl:apply-templates mode="link" select="."/></li>
+  </xsl:template>
+
+  <xsl:template match="g:span[@href]|g:para[@href]|g:item[@href]" mode="link">
+    <a href="{@href}">
+      <xsl:apply-templates mode="日本語" select="."/>
+    </a>
+  </xsl:template>
+
+  <xsl:template match="*" mode="link">
+    <xsl:apply-templates mode="日本語" select="."/>
+  </xsl:template>
+
+  <xsl:template match="*" mode="日本語">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="*[lang('ja') and not(ancestor::*[@xml:lang='ja'])]" mode="日本語">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="g:span[lang('ja') and not (ancestor::*[@xml:lang='ja'])][not(@href)]" mode="日本語">
+    <span xml:lang="ja">
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+  
+  <xsl:template match="*[lang('fr')]" mode="日本語">
+    <xsl:apply-templates/>
+  </xsl:template>
+  
+  <xsl:template match="g:span[lang('fr')][not(@href)]" mode="日本語">
+    <span xml:lang="fr">
+      <xsl:apply-templates/>
+    </span>
+  </xsl:template>
+
+</xsl:stylesheet>