xsl-list
[Top] [All Lists]

Re: [xsl] template to convert all attributes' name to lowercase

2009-05-28 02:39:22
xmlns:xsl="http://www.w3.org/TR/WD-xsl"; - it is very old stuff you
should try xmlns:xsl="http://www.w3.org/1999/XSL/Transform";

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      xmlns:xs="http://www.w3.org/2001/XMLSchema";
      exclude-result-prefixes="xs"
      version="2.0">

    <xsl:template match="*">
        <xsl:element name="{lower-case(local-name(.))}"
namespace="{namespace-uri(.)}">
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates/>
        </xsl:element>
    </xsl:template>

    <xsl:template match="@*">
        <xsl:attribute name="{lower-case(local-name(.))}" >
            <xsl:value-of select="."/>
        </xsl:attribute>
    </xsl:template>

</xsl:stylesheet>

On Thu, May 28, 2009 at 8:10 AM, Heping Zhang 
<phoenix(_dot_)zhp(_at_)gmail(_dot_)com> wrote:
hello,
I hava a task to convert all attributes' name in a xslt file to
lowercase. Actually I don't know whether it's a xslt file. It looks
strange, like this:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
       <xsl:template match=" / ">
               <HTML>
                       <BodY bgColor="#c0c0c0" Class="screen" 
FNSType="SINGLEPAGESCREEN"
id="FNSScreen">
                       //many html things go here.
                       </BodY>
               </HTML>
       </xsl:template>
</xsl:stylesheet>
I don't know why the html pretend itself as a xslt.
I'm a novice of  xslt and have only two days to finish this task.
First I think its a simple thing but it seems not. But maybe its a
common task? So I wonder whether there is a template for this? If so,
could you please send me a copy? Thank you!
If there's no such template, I'll try my best to do it.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--