[Home] [By Thread] [By Date] [Recent Entries]
Dear Terry,
Your new problem suggests you might want to match at the level of Items, not of Answers, since you want one listing for every Item, not for every answer as you first had it. It's not really complicated at all -- actually it's about as simple as your first problem. But to solve it, you need to understand what the processor is doing with your templates. I'd suggest running a stylesheet that has absolutely no templates at all. Then introduce a template just to match something out near the branches or leaves of the tree (the Item or Answer will do), *without* your template matching the root (that selects your elements from the three), and see if you can explain what is happening when you run that. Once you figure this out (and there's lots of helpful literature on the topic), problems like your new one become trivially easy. To give you another way into this mystery, here's a stylesheet that *almost* does what you're asking for. When you can explain how this works, you'll be in good shape: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:strip-space="Story GrammarQuiz"/> <xsl:template match="GrammarTopic"/> <xsl:template match="Directions"/> <xsl:template match="Item"> <xsl:number level="any" format="1.	"/> <xsl:apply-templates select="Answer"/> </xsl:template> </xsl:stylesheet> The addition of just a single template to this will get you what you've asked for. But you'll need to understand why this works before it becomes obvious what that template should do. Then, XSLT becomes easy and fun. Without this understanding, it remains bothersome and intractable. Nor will the XSLT Cookbook or any "bottom-up" learning approach (copying code and modifying it) help very much till you have this "Aha". I gave you more hints in the last email, too. Cheers, Wendell At 09:48 PM 2/24/2006, you wrote: Thanks 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 ======================================================================
|

Cart



