[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Question about creating 2 output nodes from 1 input node
> 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|