Bug 12399 - translate
Summary: translate
Status: CLOSED INVALID
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.20.4
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-08 14:42 UTC by Tim Lebedkov
Modified: 2012-04-01 13:55 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Lebedkov 2002-09-08 14:42:50 UTC
translate()-function does not work
I used this xml:
<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Test.xml
    Created on : 8. September 2002, 16:31
    Author     : tim
    Description:
        Purpose of the document follows.
-->

<root>
	this is text in lowercase
</root>

with this xsl:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!--
    Document   : test.xsl
    Created on : 8. September 2002, 16:31
    Author     : tim
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">

    <xsl:template match="root">
		<xsl:variable name="upper_case" 
select="ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ"/>
		<xsl:variable name="lower_case" 
select="abcdefghijklmnopqrstuvwxyzäöü"/>
		<xsl:value-of select="."/>
		<xsl:value-of select="translate(string(.), $lower_case, 
$upper_case)"/>
    </xsl:template>
</xsl:stylesheet>

and the result was:
<?xml version="1.0" encoding="UTF-8"?>

	this is text in lowercase

	this is text in lowercase
The second line should be upper-case

thanx
Comment 1 J.Pietschmann 2002-09-08 15:45:10 UTC
1. XSLT problems are not FOP problems. They should be reported to the
  XSLT processor team.
2. The translate function does work. The problem is here:
 <xsl:variable name="upper_case" select="ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ"/>
                                        ^^^^
Do a <xsl:value-of select="$upper_case"/>. The result is an empty string. The
variable gets the value of the element ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ assigned,
which does not exist, therefore the variable has the empty node set as value.
The translate function call is actually translate(.,'',''), a noop.
Use
 <xsl:variable name="upper_case" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÜ'"/>
to get the string assigned to the variable.
Comment 2 Glenn Adams 2012-04-01 13:55:52 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs