I have a collection of hierarchical XML files that looks like this:
Code:
<container type="Box" >
<property name="BoxName">Name of box</property>
<container type="Folder">
<property name="FolderName">Name of folder</property>
<container type="Document">
<content type="text" file=".\DocumentTextFile.txt"/>
<property name="DocName">Name of document</property>
What I need is to add to each "container" element a GUID property. GUID can be generated in .NET by System.Guid.NewGuid() (
http://msdn.microsoft.com/en-us/libr...d.newguid.aspx)
So this would turn the sample above into something like this:
Code:
<container type="Box" >
<property name="GUID">0f8fad5b-d9cb-469f-a165-70867728950e</property>
<property name="BoxName">Name of box</property>
<container type="Folder">
<property name="GUID">7c9e6679-7425-40de-944b-e07fc1f90ae7</property>
<property name="FolderName">Name of folder</property>
<container type="Document">
<content type="text" file=".\DocumentTextFile.txt"/>
<property name="GUID">7c9e6679-7425-abcd-944b-e07fc1708677</property>
<property name="DocName">Name of document</property>
What would be the best way to do that? Does XSLT have capabilities to generate a GUID? If not, it seems that the only way to do this is in C#. Or is there another way?
Thanks much!