I have a jsp that parses an xml file containing tags describing documents and folders 
within a document management system.  The page transforms the xml into a different 
format used by a bulk load utility for another system.

I have a loop which selects all documents (which are denoted by an attribute 
"filename").  At this point, I wish to identify the ancestor nodes above the document 
which are folders (denoted by the attribute objname="Folder").  These folder nodes 
should appear in the same order that you would see as if you were looking at the 
structure in Windows Explorer.

Here is what my code looks like:


<x:forEach select="$dom//*[./@filename != '']">
.
.
.
<!-- the next line describes the folder hierarchy where the document will reside -->
<location>Enterprise:<%=project%>:Import:<x:forEach 
select="ancestor::*[@objname='Folder']" >:<x:out select="@name" 
/></x:forEach></location>
.
.
.
</x:forEach>


It produces the following output:

<location>Enterprise:0645-02 Project Library:Import:1.6 Miscellaneous - Project 
Management:1. Project Management</location>

The problem is the folders "1.6 Miscellaneous - Project Management" and "1. Project 
Management" are in reverse order.  This is because this is how the <x: tag encounters 
them as you traverse up the tree from the document level.  The desired result is:

<location>Enterprise:0645-02 Project Library:Import:1. Project Management:1.6 
Miscellaneous - Project Management</location>

Does anyone know of a way to phrase my <x: tag so that I can achieve this?

TIA

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to