Subject: RE: [xsl] Newbie Q: Why are element contents being passed through? From: "Allan Jones" <allan.jones@xxxxxxxxxxxx> Date: Thu, 10 Apr 2003 10:37:21 +0100 |
I've had a quick look at this, and there's a couple of problems. Firstly, the input document contains an <input> element that hasn't been closed: <openingtime> <label>Opening Time</label> <input type="select" option="singlechoice"> <option value="10:00">10:00</option> This needs to be closed if you want to use this as an xml input document (i.e. </input> after the list of options, as in the following input). The main problem, though, is that you're not taking the default templates into account: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="*|/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="text()|@*"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="*|/" mode="?"> <xsl:apply-templates mode="?"/> </xsl:template> <xsl:template match="text()|@*" mode="?"> <xsl:value-of select="."/> </xsl:template> <xsl:template match="processing-instruction()|comment()"/> <xsl:template match="processing-instruction()|comment()" mode="?"/> </xsl:stylesheet> These templates are automatically included whenever you create an xsl. Your apply-templates call within the form template is calling on these templates, and as you can see, whenever it finds a text node it'll output the value of that node in your output document, causing the output you see. What you'll have to do is create a set of templates matching the rest of the elements in your document to control how they'll be output in your document. If you're just going to copy them over, however, you could just replace the call to apply-templates with a for-each loop that will make a copy-of each child element: <xsl:for-each select="*"> <xsl:copy-of select="."/> </xsl:for-each> Hope that helps, b XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Newbie Q: Why are element, Dimitre Novatchev | Thread | RE: [xsl] Newbie Q: Why are element, Michael Kay |
[xsl] How to create client side fun, Ilse De Cokere | Date | [xsl] How to use an xml Element in , John Barden |
Month |