RE: [xsl] Muenchian method, and keys 'n stuff

Subject: RE: [xsl] Muenchian method, and keys 'n stuff
From: DPawson@xxxxxxxxxxx
Date: Wed, 23 Jan 2002 08:47:59 -0000
Hi Jeni

  (That's becoming the ritual greeting on this list now ;-)

> > the problem is now that the template below never
> > fires the otherwise clause of the choose, and I can't see why.
> 
> The only reason I can see why the xsl:otherwise wouldn't be fired is
> if the $auths variable always gets set to a node set that contains
> some nodes. That would be true if within your document you have at
> least one r element with a Ra/lett equal to each letter of the
> alphabet. Which could be the case - it's impossible to tell without
> seeing your document.

Out of 2200 books, that's highly likely, though the scoping of
'within adventure' makes it not true for this scope.


> 
> Note that the way you have it at the moment, it's perfectly possible
> for the xsl:when clause to be selected but you to see no output from
> it. When you do:
> 
> >       <xsl:when test="$auths/node()">
> >         <xsl:apply-templates select="r[generate-id(.)=
> >                       generate-id(key('auth',Ra/lett)[1])]"/>
> >       </xsl:when>
> 
> Then you're only applying templates to the r element children of the
> current adventure that happen to be the first such r elements in the
> document as a whole with that letter in their Ra/lett grandchild.
> 
> In fact, the path you're using there is exceedingly strange, since it
> will give you the same thing on each recursion, but I guess you're
> doing that on purpose?

I was suspicious of what key() was returning, hence I'm looking for
$auths only if it has children, hence the addition to your code.

What I really want is a key which has a given scope of 'here'
(wherever specified) and its descendants.

Then I could write

<xsl:template match="adventure">
<xsl:key name ="auth" ...

which would only match those I wanted.

Strange, that keys have been given only the current document as scope,
I can't use them across n documents, I can't use them in a section
of a document... I'm sure there are other use cases for limited
scope keys. Feature for consideration for 2.0?

Regards DaveP

- 

NOTICE: The information contained in this email and any attachments is 
confidential and may be legally privileged. If you are not the 
intended recipient you are hereby notified that you must not use, 
disclose, distribute, copy, print or rely on this email's content. If 
you are not the intended recipient, please notify the sender 
immediately and then delete the email and any attachments from your 
system.

RNIB has made strenuous efforts to ensure that emails and any 
attachments generated by its staff are free from viruses. However, it 
cannot accept any responsibility for any viruses which are 
transmitted. We therefore recommend you scan all attachments.

Please note that the statements and views expressed in this email 
and any attachments are those of the author and do not necessarily 
represent those of RNIB.

RNIB Registered Charity Number: 226227

Website: http://www.rnib.org.uk 


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


Current Thread