[xsl] Adding elements to unknown tree structure

Subject: [xsl] Adding elements to unknown tree structure
From: Gustave Stresen-Reuter <tedmasterweb@xxxxxxx>
Date: Wed, 21 Sep 2005 16:41:53 +0100
Given:

<myxmlfile>
    <folder name="root">
        <folder name="documents">
            <document name="passwords">
                123456
            </document>
        </folder>
        <folder name="pictures">
            <folder name="family" />
        </folder>
    </folder>
</myxmlfile>

parameter: folder_name = "friends"
parameter: path2folder = root/pictures

How can I create a new folder element named "friends" in the pictures element?

Keep in mind that I need to make sure that both "root" and "pictures" exist and if they don't, create them first.

Also, I use a "tokenizer" to split the path in the path2folder parameter to access the individual values, but it sure would be great if I could use something like an eval() function to go right to the folder...

I'm sure I can figure this out myself, but thought I'd check with the list before losing too much time reinventing the wheel.

Thanks in advance.

Ted Stresen-Reuter

Current Thread