Hi, I'm learning xsl and am encountering an unexpected result with the xml / xsl below The xsl result includes text from the printsettings nodes: "1none", and since this was not included in the select attribute. It's strange that the unspecified node is the first node of the document. I've simplified the xml document to remove other nodes, but when those nodes were present it was still only the first node that had it's text printed out. If you have any idea why the text of the printsettings nodes is being printed I'd appreciate hearing the explanation. I'm using Microsofts XMLNotepad to view the output Thank you, Rod <?xml version="1.0" encoding="utf-8"?> <template> <printsettings> <orientation>1</orientation> <header>none</header> </printsettings> <columns> <colrange name="C1"> <coldimspecs> <coldimspec > <memberspecs> <memberspec /> </memberspecs> </coldimspec> <coldimspec dimensionname="Scenario" > <memberspecs> <memberspec memberkey="" /> </memberspecs> </coldimspec> </coldimspecs> </colrange> <colrange name="C2"> <coldimspecs> <coldimspec > <memberspecs> <memberspec /> </memberspecs> </coldimspec> <coldimspec dimensionname="Scenario" > <memberspecs> <memberspec memberkey="" /> </memberspecs> </coldimspec> </coldimspecs> </colrange> </columns> </template> <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform"> <xsl:template match="/"> <HTML> <BODY> <xsl:apply-templates/> </BODY> </HTML> </xsl:template> <xsl:template match="columns/colrange"> <TABLE BORDER="1" width="40%" > <TR> <xsl:value-of select="local-name()"/> <xsl:text>: </xsl:text> <xsl:value-of select="@name"/> <xsl:text> </xsl:text> <xsl:value-of select="@description"/> <xsl:for-each select="*/*/*/*"> <TD> <xsl:value-of select="local-name()"/> </TD> </xsl:for-each> </TR> </TABLE> </xsl:template> </xsl:stylesheet>
vanSkier wrote: > The xsl result includes text from the printsettings nodes: "1none", > and since this was not included in the select attribute. > <xsl:template match="/"> > <HTML> > <BODY> > <xsl:apply-templates/> Here you process the child nodes of the root node so in your sample XML then 'template' element is processed by a matching template. As you have not provided one yourself the default template is used which processes all child nodes of the context node, in that case the 'printsettings' element and the 'columns' element. As you have not provided a matching template for 'printsettings' yourself the default tempate is used and that way, you end up with the text contents of child elements output to the result tree. To fix that, use <xsl:apply-templates select="template/columns/colrange"/> above, instead of the <xsl:apply-templates/> that you have. -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/