convert the lower case to upper case

Hi Guys,

If you have a look at the attached code... the xslt reads attributes "from" and  "to" from the source document. in the source document, they are in lower-case. I want them be written in the results document in an upper case. Please look at my code where I have tried but  it did not work where it gives me the following error:

******
  SXXP0003: Error reported by XML parser: Element type "xsl:value-of" must be followed by
  either attribute specifications, ">" or "/>".
Failed to compile stylesheet. 1 error detected.

<from><xsl:value-of select="translate("@from", $smallcase, $uppercase)"/></from>
            <to><xsl:value-of select="translate("@to", $smallcase, $uppercase)"/></to>

Open in new window

AussieSilverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AussieSilverAuthor Commented:
My be it is not clear but here is the full xslt code:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
    <xsl:output method="xml" version="1.0" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:key name="search" match="wordEntry" use="search"/>
    <xsl:key name="replace" match="wordEntry" use="concat(search, '-', replace)"/>
    <xsl:template match="wordlist">
        <Dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="translation.xsd">
            <from><xsl:value-of select="translate("@from", $smallcase, $uppercase)"/></from>
            <to><xsl:value-of select="translate("@to", $smallcase, $uppercase)"/></to>
            <total>
                <xsl:value-of select="count(wordEntry[generate-id() = generate-id(key('search', search)[1])])"/>
            </total>
            <xsl:apply-templates select="wordEntry[generate-id() = generate-id(key('search', search)[1])]"/>
        </Dictionary>
    </xsl:template>
    <xsl:template match="wordEntry">
        
        <translation initial="{substring(search ,1,1)}">
            <xsl:variable name="this-search" select="search"></xsl:variable>
            <xsl:copy-of select="search"/>
            <counter>
                <xsl:value-of select="count(//wordEntry[generate-id() =  generate-id(key('replace', concat($this-search, '-', replace))[1])])"/>
            </counter>
            <xsl:for-each select="//wordEntry[generate-id() =  generate-id(key('replace', concat($this-search, '-', replace))[1])]">
                <xsl:copy-of select="replace"/>
            </xsl:for-each>
        </translation>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0
Gertone (Geert Bormans)Information ArchitectCommented:
remove the double quotes from the attributes @from and @to
 <from><xsl:value-of select="translate(@from, $smallcase, $uppercase)"/></from>
            <to><xsl:value-of select="translate(@to, $smallcase, $uppercase)"/></to>
 
0
Gertone (Geert Bormans)Information ArchitectCommented:
you also seem to miss a declaration for $smallcase and $uppercase?
This will work
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >
    <xsl:variable name="smallcase" select="'azertyuiopqsdfghjklmwxcvbn'"></xsl:variable>
    <xsl:variable name="uppercase" select="'AZERTYUIOPQSDFGHJKLMWXCVBN'"></xsl:variable>
    <xsl:output method="xml" version="1.0" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:key name="search" match="wordEntry" use="search"/>
    <xsl:key name="replace" match="wordEntry" use="concat(search, '-', replace)"/>
    <xsl:template match="wordlist">
        <Dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="translation.xsd">
            <from><xsl:value-of select="translate(@from, $smallcase, $uppercase)"/></from>
            <to><xsl:value-of select="translate(@to, $smallcase, $uppercase)"/></to>
            <total>
                <xsl:value-of select="count(wordEntry[generate-id() = generate-id(key('search', search)[1])])"/>
            </total>
            <xsl:apply-templates select="wordEntry[generate-id() = generate-id(key('search', search)[1])]"/>
        </Dictionary>
    </xsl:template>
    <xsl:template match="wordEntry">
        
        <translation initial="{substring(search ,1,1)}">
            <xsl:variable name="this-search" select="search"></xsl:variable>
            <xsl:copy-of select="search"/>
            <counter>
                <xsl:value-of select="count(//wordEntry[generate-id() =  generate-id(key('replace', concat($this-search, '-', replace))[1])])"/>
            </counter>
            <xsl:for-each select="//wordEntry[generate-id() =  generate-id(key('replace', concat($this-search, '-', replace))[1])]">
                <xsl:copy-of select="replace"/>
            </xsl:for-each>
        </translation>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Shinesh PremrajanEngineering ManagerCommented:
i think its causing due to the imbalance in the double quotes,

Pls refer the snippet

Hope this helps
<from><xsl:value-of select="translate(@from, $smallcase, $uppercase)"/></from>
            <to><xsl:value-of select="translate(@to, $smallcase, $uppercase)"/></to>

Open in new window

0
AussieSilverAuthor Commented:
YOU ARE THE BEST !!!!
0
AussieSilverAuthor Commented:
Sorry shinug

I should have declared the $smallcase and $uppercase....
0
Gertone (Geert Bormans)Information ArchitectCommented:
Note that:
- in XPath functions and expressions, you don't need to put quotes (or single quotes) around the XPath. It will be evaluated as a string, in this case you don't want the string "@from" in the translate(); you want the attribute from
- strings in double-quote delimited attribute values should be seperated by single -quotes, to keep the balance right
- the translate function is a work-around for uppercasing in this example, but you will need every character in the uppercase, explicitely mentuioned in a variable, which I added for you
0
Gertone (Geert Bormans)Information ArchitectCommented:
welcome
0
AussieSilverAuthor Commented:
GREAT... thanks very much Gertone... I wish i give you 1000000 points
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.