Extend XML file attributes using XSLT

Christian Rühl <[email protected]> Fri, 09 Nov 2007 08:55:18 -0000
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization http://groups.google.com
Message-ID <[email protected]>
Hi folks!

I have a little noob problem here with XSLT. I have a XML file that
looks like this:

<archiveFiles>
   <module path="c:/temp/module_m17_blabla.tmp"/>
   <module path="c:/temp/module_m34_blabla.tmp"/>
   ...
   <moduleAddition path="c:/temp/moduleaddition_m17.tmp"/>
   ...
</archiveFiles>

What I want to do now is the following:

1.) Copy name part of filename in <module>
---------------------------------------------
I want to copy that module name part and add it to a new attribute
called "name". How should I do this? The name of each module comes
right after module_ in the path-attributes.

2.) Reference additional information to these modules
---------------------------------------------
Finally another attribute "addition" should be added to each <module>
when there is a <moduleAddition> node with the same module name in its
"path" attribute. So that the outcome of the upper XML file looks like
this:

<archiveFiles>
   <module name ="m17" path="c:/temp/module_m17_blabla.tmp"
additon="c:/temp/moduleaddition_m17.tmp"/>
   <module name ="m34" path="c:/temp/module_m34_blabla.tmp"/>
   ...
</archiveFiles>

I really hope you can help me. I never worked with XSLT before and I
couldn't find the right hints and/or tutorials yet. :(

Thanks a lot in advance!

/Chris