[xslt] XSLT Problem with recursiv functions
- From: Bernd Lang <bernd_lang non agilent com>
- To: xslt gnome org
- Subject: [xslt] XSLT Problem with recursiv functions
- Date: Wed, 05 Nov 2003 15:53:09 +0100
Hello,
we detected a xslt problem in the Redhat 3.0 enterprise edition.
We use in our project xsltproc for generating C code. In our
stylesheets we implemented some recursiv functions.
All this stuff worked under RH8.0 which uses the libs
libxslt-1.0.19-1
libxml2-2.4.23-1
libxml2-devel-2.4.23-1
In the new version RHEL3.0 we detected many new libs related to the xslt
stuff.
libxslt-1.0.33-1
docbook-style-xsl-1.61.2-2
libxslt-devel-1.0.33-1
libxml2-2.5.10-5
libxml2-python-2.5.10-5
xml-common-0.6.3-14
xmlto-0.0.14-3
libxml2-devel-2.5.10-5
libxml-1.8.17-9.1
With the new version the recursiv functions doesn't work anymore.
We generated a very simple example for testing. The files you need
are attached.
adts.h.xsl - xsl stylesheet for generating a header file
adt.dtd - the rules for generating a header file needed by adts.h.xsl
pcmdb_test_head_database.adt - the xml file as input
We use the following command:
xsltproc adts.h.xsl pcmdb_test_head_database.adt >
pcmdb_test_head_database.h
The result contained in the file pcmdb_test_head_database.h has to be
typedef struct Pcmdb_TestHeadDatabase Pcmdb_TestHeadDatabase;
Do you have any idea what could cause the problem?
Thanks in advance for any help.
Regards
Bernd Lang
<!-- adt.dtd -->
<!ENTITY % full-docu "author, date, brief, detailed, deprecated?" >
<!ENTITY % lazy-docu "author, date, brief, detailed?, deprecated?" >
<!ENTITY % function-parts "name, %lazy-docu;, parameter*">
<!ENTITY % function-parts-return "%function-parts;, return?">
<!ENTITY % implicit "new?, delete?, clear?, copy?, equals?, compare?" >
<!ENTITY % html "(#PCDATA|a|b|br|code|i|pre|ul|ol|li)*">
<!ELEMENT adt (prosa-name, prefix, author, date, brief, detailed?, deprecated?,
detailed-for*, (public|package) )
>
<!ATTLIST adt
isTemplate (yes|no) "no"
ingroup CDATA #IMPLIED
>
<!ELEMENT name (#PCDATA)>
<!ELEMENT prosa-name (#PCDATA)>
<!ELEMENT prefix (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT brief %html;>
<!ELEMENT detailed %html;>
<!ELEMENT public (uses*, %implicit;, uses*, typedef*, enum*, constant*,
operation+, inner-adt*)
>
<!ELEMENT package (uses*, %implicit;, uses*, typedef*, enum*, constant*,
operation+, inner-adt*)
>
<!ELEMENT a EMPTY>
<!ATTLIST a
package CDATA #IMPLIED
item CDATA #REQUIRED
>
<!ELEMENT b %html;>
<!ELEMENT br %html;>
<!ELEMENT code %html;>
<!ELEMENT i %html;>
<!ELEMENT pre %html;>
<!ELEMENT ul %html;>
<!ELEMENT ol %html;>
<!ELEMENT li %html;>
<!ELEMENT new (detailed)>
<!ELEMENT delete (detailed)>
<!ELEMENT clear (detailed)>
<!ELEMENT copy (detailed)>
<!ELEMENT equals (detailed)>
<!ELEMENT compare (detailed)>
<!ELEMENT uses (#PCDATA)>
<!ATTLIST uses
path (system|software) #REQUIRED
>
<!ELEMENT typedef (name, brief, detailed?, deprecated?,
(value|function-pointer))>
<!ELEMENT enum (name, brief, detailed?, deprecated?, enum-value+)>
<!ELEMENT enum-value (name, brief, detailed?, deprecated?, value?)>
<!ELEMENT constant (name, brief, detailed?, deprecated?, type, value)>
<!ELEMENT operation ( %function-parts-return;) >
<!ATTLIST operation
const (yes|no) "yes"
static (yes|no) "no"
varargs (yes|no) "no"
>
<!ELEMENT parameter (name, brief, detailed?, type, precon?)>
<!ELEMENT type (#PCDATA)>
<!ATTLIST type
stereotype (const-ref|ref|value|const-array|array) #REQUIRED
>
<!ELEMENT value (#PCDATA)>
<!ELEMENT function-pointer (parameter*, return?) >
<!ELEMENT return (brief, detailed?, type, return-value*)>
<!ELEMENT return-value (#PCDATA)>
<!ATTLIST return-value value CDATA #REQUIRED>
<!ELEMENT precon (include-value*,exclude-value*,expr*) >
<!ELEMENT include-value (#PCDATA)>
<!ELEMENT exclude-value (#PCDATA)>
<!ELEMENT expr (#PCDATA)>
<!ELEMENT inner-adt (prosa-name, author, date, brief, detailed?, deprecated?,
uses*, %implicit;, uses*,typedef*, enum*, constant*,
operation+, inner-adt* )>
<!ATTLIST inner-adt
equals (yes|no) "yes"
compare (yes|no) "yes"
allow-instantiation (yes|no) "yes"
>
<!ELEMENT deprecated (#PCDATA)>
<?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),
'; ' )" />
</xsl:template>
<!-- finished -->
</xsl:stylesheet>
<?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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]