Subject: Re: Question about creating 2 output nodes from 1 input node From: David Carlisle <davidc@xxxxxxxxx> Date: Tue, 23 Nov 1999 18:34:25 GMT |
> I know what rules to write to output the first part of the output tree > (the paragraphs and their titles), but I don't understand how I can add > the list of nodes that contains the information that are already used > to make the 1st part of the output tree. > You can go over the input tree as often as you like. Below I use apply-templates for the first, and for-each to go over again. If the formating of the second pass were more complicated I would probably have used apply-templates again but with a different mode. The following assumes you put <x> </x> around your example to make it a well formed document, <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" > <xsl:output method="xml" indent="yes" /> <xsl:template match="x"> <xsl:apply-templates/> <list> <xsl:for-each select="title"> <p><a name="{@id}"/><xsl:value-of select="."/></p> </xsl:for-each> </list> </xsl:template> <xsl:template match="title"> <a href="#{@id}"><xsl:value-of select="."/></a> </xsl:template> <xsl:template match="p"> <p> <xsl:apply-templates/> </p> </xsl:template> </xsl:stylesheet> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Question about creating 2 output no, Yannick Nicolas | Thread | Re: Question about creating 2 outpu, Phil Lanch |
XPath, preceding-sibling and sorted, Tangi Vass | Date | Re: XPath, preceding-sibling and so, David Carlisle |
Month |