hi, I need select a node like "//element[@attr='value']", but the "attr" in document can be "Attr", "ATtr" and so on, as well as the "value".
I know I can select element with case insensitive using translate function like "//*[translate(name(), 'abc','ABC')='ABC']"
But how can I let it work with attribute and its value?
Can anybody help me? Thanks.

Hello to XML user

xml for testing

<?xml version="1.0"?>
<element attr='Abc'/>
<element Attr='ABc'/>
<element ATtr='abC'/>
<element attr='ABC'/>
<element attr='AbC'/>
<element class='AbC'/>

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml"/>
<xsl:template match="/">
    <xsl:apply-templates select="//element"/>

<xsl:template match="element">
<xsl:when test="translate(name(@*),'art','ART')='ATTR'">
<xsl:value-of select="concat(@*,' ',translate(@*,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))"/>
<xsl:value-of select="concat(name(@*),' no change')"/>


is a problem when not use attr eg class
then i use



all Attribute


<?xml version='1.0' ?>
  <erg>Abc ABC</erg>
  <erg>ABc ABC</erg>
  <erg>abC ABC</erg>
  <erg>ABC ABC</erg>
  <erg>AbC ABC</erg>
  <erg>class no change</erg>

Helmut Hagemann

This article has been dead for over six months. Start a new discussion instead.