Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Creating a table within a XSL-stylesheet [Thread Next] Re: Creating a table within a XSL-stylesheetTo: NULL Date: 12/2/2004 2:08:00 PM You've used <xsl:apply-templates select="ingredients"/> outside the table - how do you expect its output to get automagically placed *inside* the table ? Also (anyway) there's no 'ingredients' template, so probably it's just using the default stylesheet template (which is to output all the text nodes in your selected node, in this case "cookbook"). Which, it is doing, as you can see all the text of the recipe is concatenated eg # Kladdkaka. dessert. Jenny. Värm ugnen till 175 grader. Smält smöret och rör ner i din smet2mskSmör2mskMjöl2mskSocker2mskBlockchoklad2mskKakao3stÄgg1tskBakpulver Why not create an "ingredients" template and see if that helps ? Cheers - Neil On 2 Dec 2004 05:32:51 -0800, tessan@t... (Tessie Sweden) wrote: >Hi! > >A table is supposed to be created inside the <body>-tags, correct? >Mine is displayed, but all of it's contents ends up OUTSIDE the table: > >http://www.student.nada.kth.se/~u1j80hrt/2D1517/XMLprojekt/recept.php > >I think it is a problem with "<xsl:apply-templates >select="ingredients"/>" on line 15. I don't know where to put it >really :)If I remove that line, everything goes away! > >This is my XSL-stylesheet: >****************************************************************** ><xsl:template match="cookbook"> > <html> > <head> > <title> > <xsl:apply-templates select="title"/> > </title> > </head> > <body> > <h1>Recipe:</h1> > <ul> > <xsl:apply-templates select="recipe"/> > </ul> > <h1>Ingredients:</h1> > > <xsl:apply-templates select="ingredients"/> > > <table border="1"> > <tr bgcolor="#ffffff"> > <th>Amount</th> > <th>Unit</th> > <th>Ingredient</th> > </tr> > <xsl:for-each select="ingredients/recipe_id"> > <tr> > <td><xsl:value-of select="amount"/></td> > <td><xsl:value-of select="unit"/></td> > <td><xsl:value-of select="ingredient"/></td> > </tr> > </xsl:for-each> > </table> > </body> > </html> > </xsl:template> > > <xsl:template match="recipe"> > <li> > <xsl:apply-templates select="recipe_name"/> > <xsl:text>. </xsl:text> > <xsl:apply-templates select="type"/> > <xsl:text>. </xsl:text> > <xsl:apply-templates select="chef"/> > <xsl:text>. </xsl:text> > <xsl:apply-templates select="description"/> > </li> > </xsl:template> > > <xsl:template match="cookbook/ingredients/amount"> > <xsl:apply-templates /> > </xsl:template> > > <xsl:template match="cookbook/ingredients/unit"> > <xsl:apply-templates /> > </xsl:template> > > <xsl:template match="cookbook/ingredients/ingredient"> > <xsl:apply-templates /> > </xsl:template> > ></xsl:stylesheet> >********************************************************************* | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
