xsl-list
[Top] [All Lists]

replace attribute name

2003-04-22 02:45:39
Hi there

I have the following Problem.

I have an xml file with the follwing structure:

<document>
        <article>
                <head></head>
                <text>
                        <paragraph></paragraph>
                        <paragraph></paragraph>
                </text>
                <date>
                        <day></day>
                        <month></month>
                        <year></year>
                </date>
                <source></source>
                <portal></portal>
                <ID number="000.000"/>
        </article>
        <article>
        [...]
        </article>
        [...]
</document>

and I want to replace the name of the attribute of ID ("number") with "idnumber" and leave the whole other contend like it is. So, I want a document with the same contend expect the attributename ...

Copying the contend was not the problem (I hope I did it in a correct way):

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
<xsl:output method="xml"/>

<xsl:variable name="finance" select="document('finance.xml')"/>

<xsl:template match="/">
   <document>
   <xsl:for-each select="//document/article">
         <xsl:copy-of select="."/>
   </xsl:for-each>
   </document>
</xsl:template>

</xsl:stylesheet>

but how can I repalce the attribute ... would be great If someone could help me....

greetings Florian Bauer


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>