Re: [xsl] Grouping problem

Subject: Re: [xsl] Grouping problem
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Jul 2002 16:33:12 +0100
Hi Mario,

> For the $offset it is rather complicated. The offset is determined
> by the structure of an LDAP string, in the XML as an attribute value
> in one of the element types. Thus, the string could be:
> "CN=one,OU=two,OU=three,DC=four,DC=five" The offset is determined by
> the number of "DC" pieces in the string (in this case 2, and which
> means I want to ignore the bottom 2 levels of the array described
> previously).
>
> I calculate this via a rather horribly complicated string split
> template, and then take a count of the number of token elements
> returned. Is there a simpler way of doing this, and that can be
> called from with key/@use ?

Hmm... Are the 'DC' pieces always the last pieces in the string? If
so, then you could take the substring after the first DC element,
strip out everything that isn't an = sign, and count how long a string
you have left:

  string-length(translate(
                  substring-after($string, 'DC'),
                  translate($string, '=', ''),
                  ''))

Otherwise, I think that what you're trying to do is of sufficient
complexity that a two-step transformation might be worthwhile. Use one
step to get the XML into a "groupable" structure, stripping out
information that isn't actually needed at the same time, and the
second step to create the groups from the data.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread