summaryrefslogtreecommitdiff
path: root/tests/exslt
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2003-11-12 10:20:03 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2003-11-12 10:20:03 +0000
commit0cd2f0c0e9ed0600d29cecb4b24bd47a080083aa (patch)
treeb1deeb43aaa75f00dc805395d8af3409e02ed744 /tests/exslt
parentcfc91f9c6956994eeb4599ee4cd95ef79e1b1fde (diff)
downloadlibxslt-0cd2f0c0e9ed0600d29cecb4b24bd47a080083aa.tar.gz
libxslt-0cd2f0c0e9ed0600d29cecb4b24bd47a080083aa.tar.bz2
libxslt-0cd2f0c0e9ed0600d29cecb4b24bd47a080083aa.zip
applied patch for param visibility from Shaun McCance. Changed variable
* libexslt/functions.c: applied patch for param visibility from Shaun McCance. Changed variable scoping in accordance with Shaun's suggestions. This fixed problem reported on the list by Bernd Lang * tests/exslt/functions/function.8.[xml,xsl,out], Makefile.am: regression test for above
Diffstat (limited to 'tests/exslt')
-rw-r--r--tests/exslt/functions/Makefile.am4
-rw-r--r--tests/exslt/functions/function.8.out2
-rw-r--r--tests/exslt/functions/function.8.xml22
-rw-r--r--tests/exslt/functions/function.8.xsl64
4 files changed, 91 insertions, 1 deletions
diff --git a/tests/exslt/functions/Makefile.am b/tests/exslt/functions/Makefile.am
index ff2e91da..d2c27c00 100644
--- a/tests/exslt/functions/Makefile.am
+++ b/tests/exslt/functions/Makefile.am
@@ -9,7 +9,9 @@ EXTRA_DIST = \
function.3.out function.3.xml function.3.xsl \
function.4.out function.4.xml function.4.xsl \
function.5.out function.5.xml function.5.xsl \
- function.6.out function.6.xml function.6.xsl
+ function.6.out function.6.xml function.6.xsl \
+ function.7.out function.7.xml function.7.xsl \
+ function.8.out function.8.xml function.8.xsl
all:
diff --git a/tests/exslt/functions/function.8.out b/tests/exslt/functions/function.8.out
new file mode 100644
index 00000000..745ace70
--- /dev/null
+++ b/tests/exslt/functions/function.8.out
@@ -0,0 +1,2 @@
+typedef struct Pcmdb_TestHeadDatabase Pcmdb_TestHeadDatabase;
+
diff --git a/tests/exslt/functions/function.8.xml b/tests/exslt/functions/function.8.xml
new file mode 100644
index 00000000..8eee16d1
--- /dev/null
+++ b/tests/exslt/functions/function.8.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<!--
+<!DOCTYPE adt SYSTEM "adt.dtd">
+-->
+
+<adt>
+
+ <prosa-name>Test Head Database</prosa-name>
+ <prefix>pcmdb</prefix>
+
+ <author>Max Mueller</author>
+ <date>August 16, 2002</date>
+
+ <brief>This adt holds relevant information regarding the test head
+ of the tester.</brief>
+ <detailed>
+ There is only one instance of the adt in the system, and you can
+ query the adt regarding parameters of the current installed test
+ head.
+ </detailed>
+
+</adt>
diff --git a/tests/exslt/functions/function.8.xsl b/tests/exslt/functions/function.8.xsl
new file mode 100644
index 00000000..5d46af1e
--- /dev/null
+++ b/tests/exslt/functions/function.8.xsl
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:func="http://exslt.org/functions"
+ extension-element-prefixes="func"
+>
+<xsl:output method="text" encoding="ISO-8859-1" omit-xml-declaration="yes" />
+
+<xsl:variable name="prefix" select="/adt/prefix" />
+<xsl:variable name="prosaName" select="/adt/prosa-name" />
+
+<xsl:variable name="suffix" select="'.h'" />
+
+<!-- makes all letters upper case -->
+<func:function name="func:upper">
+ <xsl:param name="in" />
+ <func:result select="translate($in,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
+</func:function>
+
+<!-- makes all letters lower case -->
+<func:function name="func:lower">
+ <xsl:param name="in" />
+ <func:result select="translate($in,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')" />
+</func:function>
+
+<!-- makes first letter (of every word) upper case -->
+<!-- converts first x to X and every _x to _X -->
+<!-- and every ' x' to 'X' (note the space) -->
+<func:function name="func:firstUpper">
+ <xsl:param name="in" />
+ <xsl:variable name="tmp" select="$in"/>
+ <xsl:choose>
+ <!-- Call first upper for each word -->
+ <xsl:when test="contains(substring($tmp,2),' ')">
+ <func:result select="concat(
+ func:firstUpper(substring-before($tmp,' ')),
+ func:firstUpper(substring-after(substring($tmp,2),' ')))" />
+ </xsl:when>
+ <!-- read over '_' -->
+ <xsl:when test="contains(substring($tmp,1,1),'_')">
+ <func:result select="concat('_',
+ func:firstUpper(substring($tmp,2)))" />
+ </xsl:when>
+ <!-- Make first character upper case and continue -->
+ <xsl:otherwise>
+ <func:result select="concat(func:upper(substring($tmp,1,1)),
+ substring($tmp,2))" />
+ </xsl:otherwise>
+ </xsl:choose>
+</func:function>
+
+<xsl:template match="adt">
+
+ <xsl:variable name="prosaNameLower" select="func:lower($prosaName)" />
+
+ <xsl:value-of select="concat( 'typedef struct ',
+ func:firstUpper($prefix), '_', func:firstUpper($prosaNameLower), ' ',
+ func:firstUpper($prefix), '_', func:firstUpper($prosaNameLower),
+ '; &#10;&#10;' )" />
+
+</xsl:template>
+
+<!-- finished -->
+</xsl:stylesheet>