xsl-list
[Top] [All Lists]

Recursive apply-templates

2004-05-05 07:01:49
I have this XML. I am doing a match on the nodes below
root/data.

<root>
    <data>
        <adress>
                <even>
                        <phone cont="mobile">
                                <code>099999</code>
                                <number>55555</number>
                                <prov>att</prov>
                        </phone>
                </even>
        </address>
        <value1>aaaa</value1>
        <value2>bbbb</value2>
        <value3>cccc</value3>
        <value4>dddd</value4>
        <value5>eeee</value5>
    </data>
</root>

I do <xsl:apply-templates select="root/data/*" /> 

I have a template match like this:

<xsl:template match="node()">
        <xsl:element name="local-name()"><xsl:value-of
select="key('mykey',local-name())" /></xsl:element>
</xsl:template>

The key is defined as 
<xsl:key name="mykey" match="root/data/*"
use="local-name()" />

I'm outputting XML in name value pairs. At the moment
this template match only picks up all the data that is
under root/data but leaves off anythin that is
hierarchically under it (even/phone/code etc).

How do I write a template match so that all the output
XML looks exactly like the input XML. I do not know
how to recursively 
use apply-templates. Can someone help?

Thanks
Sam

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca


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