Click here to Skip to main content
15,997,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All, I am trying to convert XML File using XSLT for function but i am getting error as "upper-case() is an unknown XSLT function." Below is My C# code and input files.

1. C# Code
XslCompiledTransform trs = new XslCompiledTransform();
trs.Load(stylesheet);
trs.Transform(filename, output);

2. XSL File input
xsl:value-of select="upper-case(title)"

3. XML File
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="myStyleSheet.xsl"?>
<catalog>
  <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
  </cd>
</catalog>



Thanks
Raviranjan
Posted
Updated 31-May-13 22:57pm
v4

1 solution

Refer - How can I convert a string to upper- or lower-case with XSLT?[^].
Quote:

In XSLT 1.0 the upper-case() and lower-case() functions are not available. If you're using a 1.0 stylesheet the common method of case conversion is translate():
XML
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

<xsl:template match="/" >
  <xsl:value-of select="translate(doc, $smallcase, $uppercase)" />
</xsl:template>

 
Share this answer
 
v2
Comments
Andreas Gieriet 2-Jun-13 2:32am    
My 5! Native XSLT 2.0 support is not given in .NET.
Cheers
Andi
Thanks a lot @Andreas Gieriet... :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900