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

AW: Muenchean grouping as template...

Subject: AW: Muenchean grouping as template...
From: Nikolas.Nehmer@xxxxxxxxxxx (Nikolas Nehmer)
Date: Mon, 16 Feb 2004 20:06:49 +0100
muenchen grouping
Thanks a lot for your hints. I'm more or less new to XML, coming from
the OO world (Java,...) so I am happy about every help.

Best regards,
Nick


|-----Ursprüngliche Nachricht-----
|Von: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-
|list@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Andreas L. Delmelle
|Gesendet: Montag, 16. Februar 2004 19:31
|An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
|Betreff: RE:  Muenchean grouping as template...
|
|> -----Original Message-----
|> From: Nikolas Nehmer
|
|> But i need to pass the nodeset on which the transform should be done
|> to the default visualizer, maybe with a param.
|> But the key for my muenchen grouping will be defined before ...
|
|
|Hi,
|
|I see (from the other thread) that you already managed to solve your
|problem, but anyway...
|
|Yes, indeed the key will be defined *before* ... but as indicated, and
as
|your trial-and-error in the other thread has shown you, you can change
the
|context in which it operates. In your case, the context was changed to
a
|node offering a match only on the root element of your source XML, so
the
|output was not as intended, but it remains a *feature* after all.
|
|(you might wanna check Dave Pawson's FAQ under 'Keys',
|http://www.dpawson.co.uk/xsl/sect2/N4852.html
|there's a few very interesting examples and demos there to show you
what
|keys do and how to use them
|
|Once you get the hang of it, you'll be surprised at how many for-each's
or
|choose/when/otherwises can be avoided by a proper combination of
xsl:key,
|generate-id() and xsl:variable...)
|
|On to your stylesheet (which seemed to be moving into the right
direction,
|apart from a few minor, yet very important details)
|
|>   <tr>
|>     <xsl:for-each select="$unique-elements">
|>      <xsl:variable name="elements-by-name"
|>         select="key('elementtags-by-name', name(.))"/>
|> 	 <td>
|>        <xsl:choose>
|>          <xsl:when test="@href">
|>            <xsl:apply-templates
|>               select="$elements-by-name[name() = name(.)]"
|>               mode="association_aggregation"/>
|
|(BUZZ!!!) _Almost_ right...
|
|Try select="$elements-by-name[name(.)=name(current())]
|
|As I understand, . returns you the current node in the current context.
|Context here is XPath (everything between [ ]), while current() gives
you
|the current node in XSLT context (determined by surrounding
|apply-templates/for-each/...) even inside angled brackets. In this
case,
|current() would return you the node being processed in the context of
the
|for-each.
|
|Further hint:
|
|It seems like you could do with the local-name() function to strip the
|namespace prefixes (no choose/when/otherwise needed):
|
|<xsl:template match="*" mode="header">
|
|  <th><xsl:value-of select="local-name(.)" /></th>
|
|</xsl:template>
|
|
|Cheers,
|
|Andreas
|
|
| XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 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.