Subject: using xsl:key to generate list of back references From: "Sebastian Rahtz" <sebastian.rahtz@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 16 May 2000 00:14:38 +0100 |
The Muench insight rules. Using TEI markup, where we see things like <ptr target="foo"/> to make links, I realized it was easy to get a cross-referenced list of links: <xsl:key name="targets" match="ptr" use="@target"/> ...... <xsl:for-each select="//ptr[generate-id(.)=generate-id(key('targets',@target)[1])]"> <xsl:sort select="@target"/> Key <xsl:value-of select="@target"/> <xsl:for-each select="key('targets',@target)"> <xsl:sort select="name(.)"/> Referred to in section <xsl:apply-templates mode="header" select="ancestor::div[last()]"/> </xsl:for-each> </xsl:for-each> which generates, eg, Key history.def Referred to in section 3.2 Key ignores.def Referred to in section 3.1 Key msad Referred to in section 2.1 Referred to in section Appendix A.ii Key msadac Referred to in section Appendix A.ii Key msadad Referred to in section 2.3 Referred to in section 2.8 Referred to in section Appendix A.ii which makes me pretty happy. What bothers me is the (relative) inelegance of <xsl:for-each select="//ptr[generate-id(.)=generate-id(key('targets',@target)[1])]"> when what I really want to say is something like <xsl:for-each select="key('targets','')"> and somehow access the indices of the key structure. Is this unreasonable of me? The processor has all the information I want, right to hand, but it forces me to send it off on a wild goose chase of //ptr[generate-id(.)=generate-id(key('targets',@target)[1])] which is boring. Anyone up for Yet Another Extension? Sebastian Rahtz XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Browser support for the new nam, David Schach | Thread | Re: using xsl:key to generate list , David Marston/CAM/Lo |
Re: feature request, Paul Grosso | Date | Re: feature request, Sebastian Rahtz |
Month |