xsl-list
[Top] [All Lists]

[xsl] How To Calculate Set of Unique Values Across a Tree of Input Documents

2008-03-21 11:53:25
I have a tree of DITA map documents where each map references zero or more other map or topic documents. The same map or topic could be referenced multiple times.

I need to calculate the "bounded object set" of unique documents referenced from within the compound map so that I can then use an XSLT process to create new copies of each document. Since I can't write to a given result more than once I have to first remove any duplicates.

Each target document is referenced by a relative URI that can be different for different references to the same file (and in fact will almost always be different in my particular data set).

I am using XSLT 2.

Because key() tables are bound to input documents I don't think I can build a table of references indexed by target document URI (that is, the absolute URI of the target of the reference). If I could I would simply build that table and then just process the first member of each entry.

I can't think of any other efficient way to approach this. The best idea I can come up with is to build an intermediate document that reflects each document reference and then use something like for-each-group on that to treat it as a set for the purpose of processing each referenced file exactly once. If I build a flat list of elements containing the document URI of each reference I can easily sort the values and then remove duplicates. So maybe that's as efficient as anything else would be.

My other challenge is that my input data set is very large so I have the potential to run into memory issues, so it may be that writing out an intermediate file as part of a multi-stage, multi-transform pipeline is the best process, but my current processor will handle the entire data set in one process for the purpose of applying the (mostly) identity transform to the map set.

Can anyone suggest other solution approaches to this problem?

Once again I feel like I might be missing a clever solution hidden in the haze of my XSLT 1 brain damage.

Thanks,

Eliot

--
Eliot Kimber
Senior Solutions Architect
"Bringing Strategy, Content, and Technology Together"
Main: 610.631.6770
www.reallysi.com
www.rsuitecms.com

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>