[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Multi Level Grouping using Muenchian Grouping

Subject: Re: Multi Level Grouping using Muenchian Grouping
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2002 11:36:36 +0100
xsl nodename startswith
Hi Rob,

> Thank you for your response. I in fact simplified things for posting
> so the second part of your response applies. One small point I need
> a bit of guidance on is that I need to drive this transform from a
> value from a combo box, so I presume that I need to send the value
> as a parameter to this transform. Given this what changes will i
> need to make to the tranform (I've had problems with parameters
> before :))

Without knowing how the parameter should affect the transformation,
it's hard to say. One difficulty with parameters combined with
Muenchian grouping is that you can't refer to a parameter (or global
variable) from within the match or use attributes on xsl:key. You
might want to only pick the assets whose name starts with the value in
the $name parameter, for example, in which case you'd *like* to be
able to do:

<xsl:param name="name" />

<xsl:key name="assets-by-processarea"
         match="asset[starts-with(name, $name)]/processareas/processarea"
         use="." />

but because of the restriction on where parameter references can go,
you can't do that.

Instead, you have to use the same general key definitions as before:

<xsl:key name="assets-by-processarea" match="processarea" use="." />

and then, when you *use* the key, filter the results so that it only
includes the assets that you're interested in. For example:

<xsl:variable name="process"
  select="key('assets-by-processarea', '2')
            [starts-with(../../name, $name)]" />

<xsl:template match="assets">
  <xsl:for-each
    select="$process[generate-id() =
                     generate-id(key('assets-by-level',
                                     concat(., ' ', ../../@level))
                                   [starts-with(../../name, $name)][1])]
              /../..">
    <xsl:sort select="@level" data-type="number" />
    <h1>
      <xsl:choose>
        <xsl:when test="@level = 1">AS Policies:</xsl:when>
        <xsl:when test="@level = 2">General:</xsl:when>
      </xsl:choose>
    </h1>
    <a href="{url}"><xsl:value-of select="assetname"/></a>
  </xsl:for-each>
</xsl:template>

Cheers,

Jeni

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


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.