Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7527821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:12:16+00:00 2026-05-30T04:12:16+00:00

I have an XSL transformation where I used to query a string that way:

  • 0

I have an XSL transformation where I used to query a string that way:

<xsl:value-of select="/input/as/a[@id=$id]/CaMeL[@id2=$id2]/@interest"/>

Now, it happened that CaMeL (in the XML) shall be renamed to cAmEl. Fine. Simply chaning the case in my transform would immediately work but I would lose backward compatibilty.

Searching at SO, I found this: XSLT Stylesheet: Changing text to upper case

The accepted answer looks promising but I’m currently stuck at how to fill the doc parameter used in the answer.

How could I add a translation step in my existing <xsl:template match="/"> that translates the whole doc to lower case before any other templates are going to be applied?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:12:17+00:00Added an answer on May 30, 2026 at 4:12 am

    Maybe this can help. But I didn’t test it. Could you provide some sample XML?

    <xsl:value-of select="/input/as/a[@id=$id]/*[translate(local-name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='camel' and @id2=$id2]/@interest"/>
    

    EDIT

    If you want to change your whole XML file to lower case (without elements and attributes values of course) you can use this following template:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
      <xsl:template match="@*|node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="*">
        <xsl:element name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                             'abcdefghijklmnopqrstuvwxyz')}">
          <xsl:apply-templates select="@*|node()"/>
        </xsl:element>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Having done the conversion to lower-case, you can try to create multi-pass XSLT traformation – the next pass would be your conversion. However, I’m not sure how to do it using XSLT 1.0.

    EDIT 2

    OK, so here comes the whole example. I didn’t have your examples so I worked on my own ones.

    Sample input file:

    <?xml version="1.0" encoding="UTF-8"?>
    <Root>
    <baba>aaa</baba>
    <Baba>BBB</Baba>
    </Root>
    

    XSLT with multi-pass sorting:

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:variable name="firstPassResult">
            <xsl:apply-templates select="/" mode="firstPass"/>
        </xsl:variable>
        <xsl:template match="@*|node()" mode="firstPass">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="*" mode="firstPass">
            <xsl:element name="{translate(name(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                             'abcdefghijklmnopqrstuvwxyz')}">
                <xsl:apply-templates select="@*|node()"/>
            </xsl:element>
        </xsl:template>
        <xsl:template match="/">
            <xsl:apply-templates select="$firstPassResult" mode="secondPass"/>
        </xsl:template>
        <xsl:template match="//baba" mode="secondPass">
            <xsl:value-of select="text()"/>
        </xsl:template>
    </xsl:stylesheet>
    

    I works under Altova XMLSpy debugger. Output:

    <?xml version="1.0" encoding="UTF-8"?>aaaBBB
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to xsl xml transformation. For now, I have an xml file
I have a xsl file that is grabbing variables from xml and they seem
I have nested xsl:for loops: <xsl:for-each select=/Root/A> <xsl:for-each select=/Root/B> <!-- Code --> </xsl:for> </xsl:for>
I have an xsl:fo style sheet that refers to a URL which is an
I have an XSL stylesheet (A) that imports another one (B). A overrides a
I have the following xsl template that I'm using to group my xsl. The
I have a webpage that accepts HTML-input from users. The input is converted into
I have an XML document here that is served with a corresponding XSL file
I am very new to XSL Transformation here is the question. If I have
I have MIME Multi-Part data that I want to convert to PDF using XSL:FO.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.