Subject: Re: Not grokking keys... From: James Clark <jjc@xxxxxxxxxx> Date: Thu, 22 Apr 1999 18:35:25 +0700 |
Guy_Murphy@xxxxxxxxxx wrote: > > Hi. > > Anyone care to explain, or give an example of the usage of keys? You can think of it as a generalized form of id/idref. It doesn't require you to declare things as IDs in your doucment. It allows IDs to be specified in subelements as well as in attributes. It doesn't restrict IDs to be name tokens. It allows multiple independent namespaces (*not* in the XML namespaces sense) of IDs. 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Not grokking keys..., Guy_Murphy | Thread | RE: Not grokking keys..., Kay Michael |
The recent XSLT draft..., Guy_Murphy | Date | RE: Not grokking keys..., Kay Michael |
Month |