Re: Not grokking keys...

Subject: Re: Not grokking keys...
From: Guy_Murphy@xxxxxxxxxx
Date: Thu, 22 Apr 1999 13:31:44 +0100
Hi James.

Thanks for addressing this....

I'm almost there I think. The problem I face is it still looks like
defining classes to me, I'm sure I'm only following you half-way.

<xsl:key name="titles" match="div" use="title"/>

The match="div" gets a collection together of div elements, and we can now
refer to that collection as titles as defined name="titles".

What I'm still not grasping is use="title"

And with keyref('titles', .) what's the second param got to do with
anything?

Sorry if I'm being a bit obtuse here James, what I thinks happened is I've
fallen into a groove with what I thought I was looking at, and I'm finding
it hard to get out.

Thanks for the help.

     Guy.





xsl-list@xxxxxxxxxxxxxxxx on 04/23/99 02:35:25 AM

To:   xsl-list@xxxxxxxxxxxxxxxx
cc:    (bcc: Guy Murphy/UK/MAID)
Subject:  Re: Not grokking keys...




[SNIP]
Imagine you have a document like this:
<div>
<title>Introduction</title>
<p>...</p>
<p>For more information see <divref>Expressions</divref>.</p>
</div>
...
<div>
<title>Expressions</title>
<p>...</p>
</div>
Suppose you want to transform this to HTML and you want to number the
sections and also number the cross references to sections. Then you
could use something like:
<xsl:key name="titles" match="div" use="title"/>
<xsl:template match="divref">
  <xsl:for-each select="keyref('titles', .)">
     <xsl:number level="multi" match="div" format="1.1. "/>
  </xsl:for-each>
  <xsl:value-of select="."/>
</xsl:template>
James

 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