[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Using one nodeset to dictate the format of data fr
David assumed correctly that I had one document with two parts. Your solution worked beautifully. I had a feeling that there was some simple way I was missing. I am a much happier camper (see below for the reason why I am not yet a completely happy camper). I don't mind being corrected. I would much rather be told I'm using a term incorrectly than continue using it incorrectly. With regard to the second part of my question (how to "feed" a template data from the template that called it), I am new to parameters (and to XSLT) and am having some difficulty figuring out how to handle them. Here's what I think I know about parameters: 1. xsl:param - used with stylesheets and templates, sets the parameter 2. xsl:with-param - used with apply-templates and call-template, changes the default value of the parameter, passes the parameter to the template being called (?) 3. xsl:value-of or select/name="{$paramName}" - used to get the value of the parameter 4. Tunnel parameters "have the property that they are automatically passed on by the called template to and further templated that it calls, and so on recursively" (as described by Oxygen). However, clearly I don't know enough, because my attempts to use parameters are not working. Below is what I attempted: XML: <x> <source-data> <content id="id1"><title>Title 1</title></content> <content id="id2"><title>Title 2</title></content> </source-data> <structure-data> <topic-ref idref="id1" > <topic-ref idref="id2" /> </topic-ref> </structure-data> </x> DESIRED OUTPUT: <html> <div><h1>Title 1</h1> <div><h2>Title 2</h2></div> </div> </html> STYLESHEET ATTEMPT: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> <xsl:strip-space elements="*"/> <xsl:template match="/"> <html> <head> </head> <body> <xsl:apply-templates select="x/structure-data"/> </body> </html> </xsl:template>
<xsl:template match="content"> <xsl:apply-templates select="title" > <xsl:with-param name="level"/> </xsl:apply-templates> </xsl:template> <xsl:template match="title"> <xsl:element name="{concat('h',$level)}"> <xsl:value-of select="." /> </xsl:element> </xsl:template> <xsl:key name="id" match="content" use="@id"/> </xsl:stylesheet> What am I getting wrong here? Thank you, Rebecca On 6/7/07, David Carlisle <davidc@xxxxxxxxx> wrote:
|
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
|