xsl-list
[Top] [All Lists]

Adding elements to unknown tree structure

2005-09-21 08:41:53
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--