xsl-list
[Top] [All Lists]

RE: Re: [xsl] New user issue: use of Muenchian method

2007-09-21 14:50:25
Getting pretty much off topic here, but I vote for "funniest message on
the xsl-list" for this reply.

-----Original Message-----
From: cknell(_at_)onebox(_dot_)com [mailto:cknell(_at_)onebox(_dot_)com] 
Sent: vrijdag 21 september 2007 21:05
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: Re: [xsl] New user issue: use of Muenchian method

Dr. Egon Spengler: There's something very important I forgot 
to tell you. 
Dr. Peter Venkman: What? 
Dr. Egon Spengler: Don't cross the threads. 
Dr. Peter Venkman: Why? 
Dr. Egon Spengler: It would be bad. 
Dr. Peter Venkman: I'm fuzzy on the whole good/bad thing. What 
do you mean, "bad"? 
Dr. Egon Spengler: Try to imagine all life as you know it 
stopping instantaneously and every molecule in your body 
exploding at the speed of light. 
Dr Ray Stantz: Total protonic reversal. 
Dr. Peter Venkman: Right. That's bad. Okay. All right. 
Important safety tip. Thanks, Egon. 
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com>
Sent:     Fri, 21 Sep 2007 14:21:47 -0400
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  Re: [xsl] New user issue:  use of Muenchian method

Hey Mike,

To cross with another thread --

At 10:05 AM 9/21/2007, you wrote:
<xsl:stylesheet version="2.0" ...

If you are using XSLT 2.0 I strongly recommend you investigate its 
native grouping facilities before investing too much energy into the 
Muenchian method, which is essentially a hand-made implementation of 
an algorithm to handle processing semantics that could have been much 
more deeply embedded in the language -- and which now, in XSLT 
2.0, have been.

This having been said, what you are now doing isn't (yet) a 
full-blown example of the Muenchian method. So far as I can see, it's 
simply the (appropriate) use of a key to perform node traversal 
according to an association between nodes.

It seems to me that Ken has done his usual fine work analyzing your 
stylesheet, but there's one other possible problem I see:

<xsl:template
match="Subject_AreaProps/Referenced_Entities_Array/Referenced_
Entities">
 <included-table>
  <xsl:value-of select="text()"/>
  <xsl:for-each select="key('entity-id','@id')">

.. you'd probably want select="key('entity-id',@id)". At present, 
you are using the string value "@id" as your key value -- probably 
not what you want.

It also appears that the basic issues you're having relate to the 
XSLT processing model -- how nodes are matched by templates and 
processed, and most especially how they're matched by templates and 
processed by default, even if you have no explicit logic for doing 
so. That's why Ken advises you also to read up on the built-in 
templates.

One thing I have students work out when they're at this stage is to 
run a stylesheet that *has no templates* and see if they can explain 
why they get the output they do.

The next thing I often have them do is try a stylesheet that has only 
a single template, which matches a single type of element deep in 
their tree. For example, you could have

<xsl:template match="Referenced_Entities">
  <boo>
    <xsl:apply-templates/>
  </boo>
</xsl:template>

.. and then explain the results of that. (Some people find the first 
task much easier after they've tried the second.)

It gets even more interesting if you had a second template to the mix:

<xsl:template match="Subject_AreaProps">
  <bah>
    <xsl:apply-templates/>
  </bah>
</xsl:template>

The key to all of it is in seeing what the templates are doing 
*together* -- which includes those helpful (but invisible) 
built-in templates.

Any XSLTer who can't tell you what you'll get and why is either still 
a beginner, or a poser. :-)

Cheers,
Wendell



===============================================================
====== Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
===================================================================== 

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




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




This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

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