summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-09-11 10:47:57 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-09-11 10:47:57 +0000
commitcdad73d46d0a662ec56f4a2a061cd939fe5fc8ca (patch)
tree968a10eaf5d3382e6365c6dabc68f02e3d386ed6 /tests
parentef34e3d5861d89357da08d58dacb521279fceef6 (diff)
downloadlibxslt-cdad73d46d0a662ec56f4a2a061cd939fe5fc8ca.tar.gz
close #59570 by simply not providing Norm's extension on FreeBSD. added a
* libxslt/extra.c : close #59570 by simply not providing Norm's extension on FreeBSD. * tests/general tests/docs: added a couple of new entries in the testsuite * libexslt/strings.c: NULL initialized a local variable which was tested later on. Daniel
Diffstat (limited to 'tests')
-rw-r--r--tests/docs/Makefile.am2
-rw-r--r--tests/docs/bug-57.xml8
-rw-r--r--tests/docs/bug-59.xml1
-rw-r--r--tests/general/Makefile.am3
-rw-r--r--tests/general/bug-57.out2
-rw-r--r--tests/general/bug-57.xsl21
-rw-r--r--tests/general/bug-58.xsl274
-rw-r--r--tests/general/bug-59.out2
-rw-r--r--tests/general/bug-59.xsl9
9 files changed, 322 insertions, 0 deletions
diff --git a/tests/docs/Makefile.am b/tests/docs/Makefile.am
index 36507a2e..4f3e5c57 100644
--- a/tests/docs/Makefile.am
+++ b/tests/docs/Makefile.am
@@ -59,6 +59,8 @@ EXTRA_DIST = \
bug-54.xml \
bug-55.xml \
bug-56.xml \
+ bug-57.xml \
+ bug-59.xml \
character.xml \
array.xml \
items.xml
diff --git a/tests/docs/bug-57.xml b/tests/docs/bug-57.xml
new file mode 100644
index 00000000..c65312dc
--- /dev/null
+++ b/tests/docs/bug-57.xml
@@ -0,0 +1,8 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<form>
+<field name='description'>
+<prompt>Description </prompt>
+<initialvalue>test</initialvalue>
+</field>
+</form>
+
diff --git a/tests/docs/bug-59.xml b/tests/docs/bug-59.xml
new file mode 100644
index 00000000..64ce75b4
--- /dev/null
+++ b/tests/docs/bug-59.xml
@@ -0,0 +1 @@
+<foo attribute="B&#38;B"/>
diff --git a/tests/general/Makefile.am b/tests/general/Makefile.am
index 6cda147c..dfe601b8 100644
--- a/tests/general/Makefile.am
+++ b/tests/general/Makefile.am
@@ -61,6 +61,9 @@ EXTRA_DIST = \
bug-54.out bug-54.xsl \
bug-55.out bug-55.xsl \
bug-56.out bug-56.xsl \
+ bug-57.out bug-57.xsl \
+ bug-58.out bug-58.xsl \
+ bug-59.out bug-59.xsl \
character.out character.xsl \
character2.out character2.xsl \
itemschoose.out itemschoose.xsl \
diff --git a/tests/general/bug-57.out b/tests/general/bug-57.out
new file mode 100644
index 00000000..00315b53
--- /dev/null
+++ b/tests/general/bug-57.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<input type="text" name="description">test</input><td><input type="text" name="description"/></td>
diff --git a/tests/general/bug-57.xsl b/tests/general/bug-57.xsl
new file mode 100644
index 00000000..2a3fe25b
--- /dev/null
+++ b/tests/general/bug-57.xsl
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
+ exclude-result-prefixes="l"
+ version="1.0">
+
+<xsl:output method="xml"/>
+
+<xsl:template match="form">
+<xsl:for-each select="field">
+<xsl:element name="input">
+<xsl:attribute name="type">text</xsl:attribute>
+<xsl:attribute name="name"><xsl:value-of
+select="@name" /></xsl:attribute>
+<xsl:value-of select="initialvalue" />
+</xsl:element><td><input type="text" name="description"/></td>
+
+</xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/tests/general/bug-58.xsl b/tests/general/bug-58.xsl
new file mode 100644
index 00000000..b7a14958
--- /dev/null
+++ b/tests/general/bug-58.xsl
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msxsl="http://exslt.org/common" extension-element-prefixes="msxsl">
+ <xsl:output method="html" version="1.0" encoding="iso-8859-1" indent="yes"/>
+
+ <xsl:param name="document-name"/>
+
+ <xsl:variable name="stylesheet-tree" >
+ <stylesheet href="{$document-name}">
+ <xsl:apply-templates select="/" mode="tree-building"/>
+ </stylesheet>
+ </xsl:variable>
+
+ <xsl:template match="/">
+ <html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:spec="http://www.macaw.nl/namespaces/creaim/html-specials" xmlns:fml="http://www.macaw.nl/namespaces/creaim/formsML">
+ <head>
+ <title>Documentation for: <xsl:value-of select="$document-name"/></title>
+ <link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style"/>
+ <script >
+ <xsl:comment>
+ function toggleElm(elmid)
+ {
+ var elmstyle = document.all(elmid).style;
+ //alert(document.all(elmid).nodeName);
+ if (elmstyle.display == "none")
+ {
+ elmstyle.display = "";
+ }else{
+ elmstyle.display = "none";
+ }
+ //alert(elmstyle.display);
+ }
+ </xsl:comment>
+ </script>
+ </head>
+ <body>
+ <h1>Documentation for: <xsl:value-of select="$document-name"/></h1>
+ <xsl:for-each select="xsl:stylesheet/preceding::comment()">
+ <xsl:value-of select="self::comment()" disable-output-escaping="yes"/><br/>
+ </xsl:for-each>
+ <h2>Import/Include tree</h2>
+ <xsl:call-template name="display-stylesheet-tree">
+ </xsl:call-template>
+ <h2>Parameters</h2>
+ <xsl:apply-templates select="xsl:stylesheet/xsl:param"/>
+ <h2>Global variables</h2>
+ <xsl:apply-templates select="xsl:stylesheet/xsl:variable"/>
+ <h2>Templates</h2>
+ <xsl:apply-templates select="xsl:stylesheet/xsl:template"/>
+ <h2>Other top-level elements</h2>
+ <xsl:apply-templates select="xsl:stylesheet/xsl:decimal-format|xsl:stylesheet/xsl:atribute-set|xsl:stylesheet/xsl:key|xsl:stylesheet/xsl:output|xsl:stylesheet/xsl:namespace-alias|xsl:stylesheet/xsl:preserve-space|xsl:stylesheet/xsl:strip-space"/>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template match="xsl:stylesheet/xsl:*">
+
+ <a name="elmxsl_{translate(local-name(), ':.', '__')}|{@name}|{@match}"></a>
+ <xsl:call-template name="display-xsl-element">
+ <xsl:with-param name="elm" select="self::*"/>
+ </xsl:call-template>
+ <xsl:if test="msxsl:node-set($stylesheet-tree)/stylesheet/stylesheet[@method='import']/descendant::xsl:*[name()=name(current())][@match=current()/@match][(@mode=current()/@mode) or (not(@mode) and not(current()/@mode))]">
+ Overriding identical match pattern: <xsl:apply-templates select="msxsl:node-set($stylesheet-tree)/stylesheet/stylesheet[@method='import']/descendant::xsl:*[name()=name(current())][@match=current()/@match][1]" mode="refer-to"/>
+ <br/>
+ </xsl:if>
+ <xsl:if test="msxsl:node-set($stylesheet-tree)/stylesheet/stylesheet[@method='import']/descendant::xsl:*[name()=name(current())][@name=current()/@name][(@mode=current()/@mode) or (not(@mode) and not(current()/@mode))]">
+ Overriding identical name: <xsl:apply-templates select="msxsl:node-set($stylesheet-tree)/stylesheet/stylesheet[@method='import']/descendant::xsl:*[name()=name(current())][@name=current()/@name][1]" mode="refer-to"/>
+ <br/>
+ </xsl:if>
+ <xsl:variable name="comments-before-this-element" select="preceding-sibling::comment()"/>
+ <xsl:variable name="previous-element-id">
+ <xsl:choose>
+ <xsl:when test="preceding-sibling::*">
+ <xsl:value-of select="generate-id(preceding-sibling::*[1])"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="generate-id(parent::*)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="comments-before-previous-element" select="/descendant::*[generate-id() = $previous-element-id]/preceding-sibling::comment()"/>
+ <xsl:variable name="comments-between" select="$comments-before-this-element[count(.|$comments-before-previous-element) != count($comments-before-previous-element)] "/>
+ <xsl:for-each select="msxsl:node-set($comments-between)">
+ <xsl:value-of select="self::comment()" disable-output-escaping="yes"/><br/>
+ </xsl:for-each>
+
+ <a>
+ <xsl:attribute name="href">javascript:toggleElm('code<xsl:value-of select="generate-id()"/>')</xsl:attribute>
+ View code
+ </a>
+ <PRE STYLE="border-style:solid;display:none;">
+ <xsl:attribute name="id">code<xsl:value-of select="generate-id()"/></xsl:attribute>
+ <xsl:apply-templates select="self::*" mode="code-output" />
+ </PRE>
+
+ <hr/>
+ </xsl:template>
+
+ <xsl:template match="/" mode="tree-building">
+ <xsl:param name="included-from"/>
+ <xsl:apply-templates select="descendant::xsl:template|descendant::xsl:variable|descendant::xsl:param" mode="tree-building">
+ <xsl:with-param name="included-from" select="$included-from"/>
+ </xsl:apply-templates>
+ <xsl:for-each select="descendant::xsl:import">
+ <stylesheet method="import">
+ <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
+ <xsl:apply-templates select="document(@href)" mode="tree-building"/>
+ </stylesheet>
+ </xsl:for-each>
+ <xsl:for-each select="descendant::xsl:include">
+ <stylesheet method="include"><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute></stylesheet>
+ <xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute>
+ <xsl:apply-templates select="document(@href)" mode="tree-building">
+ <xsl:with-param name="included-from" select="@href"/>
+ </xsl:apply-templates>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template match="xsl:template|xsl:variable|xsl:param|@mode|@match|@name" mode="tree-building" >
+ <xsl:param name="included-from"/>
+ <xsl:copy>
+ <xsl:if test="$included-from"><xsl:attribute name="included-from" ><xsl:value-of select="$included-from"/></xsl:attribute></xsl:if>
+ <xsl:apply-templates select="@mode|@match|@name" mode="tree-building"/>
+ </xsl:copy>
+
+ </xsl:template>
+
+ <xsl:template match="xsl:template|xsl:variable|xsl:param" mode="refer-to" >
+
+ <xsl:call-template name="link-to-stylesheet">
+ <xsl:with-param name="linking-text">
+ <xsl:call-template name="display-xsl-element-inline"/>
+ in <xsl:value-of select="parent::stylesheet/@href"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="display-xsl-element">
+ <xsl:param name="elm"/>
+ &lt;
+ <span class="xsl-elm"><xsl:value-of select="name($elm)"/></span><br/>
+ <xsl:for-each select="@*">
+ <span style="margin-left:20"><xsl:call-template name="display-attribute"></xsl:call-template><br/></span>
+ </xsl:for-each>
+
+ &gt;<br/>
+ <xsl:for-each select="xsl:param">
+ Parameter: <xsl:call-template name="display-xsl-element-inline"/><br/>
+ </xsl:for-each>
+
+ </xsl:template>
+
+ <xsl:template name="display-xsl-element-inline">
+ <xsl:param name="elm" select="current()"/>
+ &lt;<span class="xsl-elm"><xsl:value-of select="name(msxsl:node-set($elm))"/></span>
+ <xsl:for-each select="@*">
+ <xsl:text> </xsl:text>
+ <xsl:call-template name="display-attribute"></xsl:call-template>
+ </xsl:for-each>
+
+ &gt;
+
+ </xsl:template>
+ <xsl:template name="display-attribute">
+ <xsl:param name="attr" select="current()"/>
+ <span class="xsl-attr-name"><xsl:value-of select="name(msxsl:node-set($attr))"/></span> <xsl:text>=</xsl:text>
+
+ <span class="xsl-attr-value"><xsl:value-of select="msxsl:node-set($attr)"/></span>
+ </xsl:template>
+
+ <xsl:template name="display-stylesheet-tree">
+ <xsl:value-of select="$document-name"/><br/>
+ <xsl:for-each select="msxsl:node-set($stylesheet-tree)/stylesheet/descendant::stylesheet">
+ <span style="margin-left:{20*(count(ancestor::*)+1)}">
+ <xsl:value-of select="@method"/>:
+ <xsl:call-template name="link-to-stylesheet"/>
+ </span><br/>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="filename-for-stylesheet-name">
+ <xsl:param name="stylesheet-name"></xsl:param>
+ <xsl:value-of select="translate($stylesheet-name, './\', '___')"/>
+ <xsl:text>.htm</xsl:text>
+ </xsl:template>
+
+
+ <xsl:template name="link-to-stylesheet">
+ <xsl:param name="node" select="current()"/>
+ <xsl:param name="linking-text" />
+ <xsl:variable name="local-linking-text">
+ <xsl:choose>
+ <xsl:when test="$linking-text"><xsl:copy-of select="$linking-text"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$node/ancestor-or-self::stylesheet[1]/@href"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="filename-for-stylesheet-name"><xsl:with-param name="stylesheet-name" select="$node/ancestor-or-self::stylesheet[1]/@href"/>
+ </xsl:call-template>
+ <xsl:if test="not(local-name($node) = 'stylesheet')">
+ <xsl:text>#elmxsl_</xsl:text><xsl:value-of select="translate(local-name($node), ':.', '__')"/>|<xsl:value-of select="$node/@name"/>|<xsl:value-of select="$node/@match"/>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:copy-of select="$local-linking-text"/>
+ </a>
+ </xsl:template>
+
+
+
+ <xsl:template match="text()" priority="1" mode="code-output">
+ <xsl:value-of select="self::text()" />
+ </xsl:template>
+
+ <xsl:template match="*" mode="code-output">
+ <xsl:text>&lt;</xsl:text>
+ <xsl:apply-templates select="current()" mode="show-name"/>
+ <xsl:apply-templates select="@*" mode="code-output"/>
+ <xsl:text>&gt;</xsl:text>
+ <xsl:apply-templates select="node()" mode="code-output"/>
+ <xsl:text>&lt;/</xsl:text>
+ <xsl:apply-templates select="current()" mode="show-name"/>
+ <xsl:text>&gt;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="@*" mode="code-output">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="name()"/>
+ <xsl:text>=&quot;</xsl:text><xsl:value-of select="current()"/><xsl:text>&quot;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="xsl:*/@*" mode="code-output">
+ <xsl:text> </xsl:text>
+ <span class="xsl-attr-name">
+ <xsl:value-of select="name()"/>
+ </span>
+ <span class="xsl-attr-value">
+ <xsl:text>=&quot;</xsl:text><xsl:value-of select="current()"/><xsl:text>&quot;</xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="xsl:call-template/@name" mode="code-output">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="name()"/>
+ <xsl:text>=&quot;</xsl:text>
+ <xsl:call-template name="link-to-stylesheet">
+ <xsl:with-param name="node" select="msxsl:node-set($stylesheet-tree)/descendant::xsl:template[@name=current()][1]"/>
+ <xsl:with-param name="linking-text" select="string(current())"/>
+ </xsl:call-template>
+ <xsl:text>&quot;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="comment()" mode="code-output">
+ <span class="xsl-comment">
+ <xsl:text><![CDATA[<!--]]></xsl:text>
+ <xsl:value-of select="current()"/>
+ <xsl:text><![CDATA[-->]]></xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="*" mode="show-name">
+ <xsl:value-of select="name()"/>
+ </xsl:template>
+
+ <xsl:template match="xsl:*" mode="show-name">
+ <a class="xsl-elm" target="_blank">
+ <xsl:attribute name="href">http://www.vbxml.com/xsl/elmxsl_<xsl:value-of select="translate(local-name(), ':.', '__')"/>.asp</xsl:attribute>
+ <xsl:value-of select="name()"/>
+ </a>
+ </xsl:template>
+
+
+
+</xsl:stylesheet>
diff --git a/tests/general/bug-59.out b/tests/general/bug-59.out
new file mode 100644
index 00000000..c10f013a
--- /dev/null
+++ b/tests/general/bug-59.out
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+B&amp;B
diff --git a/tests/general/bug-59.xsl b/tests/general/bug-59.xsl
new file mode 100644
index 00000000..3664cf45
--- /dev/null
+++ b/tests/general/bug-59.xsl
@@ -0,0 +1,9 @@
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0">
+
+<xsl:template match="*">
+ <xsl:value-of select="@attribute"/>
+</xsl:template>
+
+</xsl:stylesheet>