[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Selecting and printing certain nodes
Hi Glenn,
At 05:41 PM 2/19/2004, you wrote: Here is the foreachOutput template: <xsl:template name="foreachOutput"> <xsl:param name="cdata" /> <xsl:param name="do-sect" /> <xsl:for-each select="$do-sect"> <xsl:choose> <xsl:when test="name() = 'replace'"> <xsl:call-template name="replaceImage"> <xsl:with-param name="var" select="$cdata" /> </xsl:call-template> </xsl:when> <xsl:when test="name() = 'variable'"> <xsl:call-template name="insertVariable"> <xsl:with-param name="var" select="$cdata" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:element name="{name()}"> <xsl:copy-of select="@*" /> <xsl:call-template name="foreachOutput"> <xsl:with-param name="do-sect" select="./*" /> <xsl:with-param name="cdata" select="$cdata" /> </xsl:call-template> </xsl:element> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> Well, as David just pointed out this template doesn't actually put any text nodes into the result, although it does construct an element whenever it gets into the xsl:otherwise. If it's constructed properly (sorry I don't have time to test; I'm still not sure I understand fully in any case), however, it might be as simple as inserting an <xsl:value-of select="$cdata"/> after the <xsl:copy-of select="@*"/> instruction in the otherwise clause. (Did David just suggest this too?) We have no "replace" or "variable" tags (which I do need to handle differently than all the other tags), we are in the xsl:otherwise but I get no text output only the tags and attributes of those tags. I need to output all the text inside the tags (expect for the "variable" and "replace" tags. Any clues? The only text you can count on being available in the named template here is what you've passed in as $cdata, plus whatever you can grab by using XPath within your context (which inside the for-each select="$do-sect" will be whatever $do-sect is). But I still don't see the necessity for template recursion here. Could you provide an example of the output you want to get from these two inputs? <foreach param="devices"> <tr><td><b>BOLDFACE</b> Some Text</td><td>Here</td></tr> <tr><td> Test11</td><td>Test</td></tr> </foreach> <doc> <item>dev1</item> <item>dev2</item> <item>dev3</item> <item>dev4</item> </doc> Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== 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
|