xsl-list
[Top] [All Lists]

Re: use of xsl:key in cross-referencing

2003-03-15 17:38:30
Xiaocun,

The most "elegant" way I can see to approach this (if I understand your question correctly) is to think of it as a grouping problem, as if you didn't have any information at all on what questionnaires the questions belonged to, and then just use the usual "Muenchian" or other approach to grouping. This does have the effect of losing the ordering in which questionnaires are listed in your first row group, in favor of the order in which they appear on questions; if you must have this order, you'll have to get even less elegant and combine the methods.

At 03:35 PM 3/15/2003, you wrote:
The way I currently handles it is create a xsl:key
matching rows in the 2nd group (questions) using the
1st cell.

Sounds good.

  When I process the 1st group of rows
(questionnaires), I call key() function by passing in
the value in the 2nd cell.

Ignore the first group of rows and just iterate over the questions, using your key to group them.

  The problem with this
approach is that it ignores question with a
questionnaire not defined in the 1st group.

Covering all the questions, you'll -- cover all the questions.

  Is there
an elegant way to address this problem?

As I said, they'll come out in the order they come out in. I'm not sure this approach counts as elegant.

An attempt, anyhow.

Cheers,
Wendell


___&&__&_&___&_&__&&&__&_&__&__&&____&&_&___&__&_&&_____&__&__&&_____&_&&_
    "Thus I make my own use of the telegraph, without consulting
     the directors, like the sparrows, which I perceive use it
     extensively for a perch." -- Thoreau


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list