Subject: Re: [xsl] Nestled Template Surrealism From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Mon, 23 Jul 2001 10:25:22 +0100 |
Hi Oliver, >> I think the root of your problem here is that you never apply >> templates to the book elements. You need to have something like: >> >> <div align="center"> >> <xsl:apply-templates /> >> </div> > > I've already tried that - the second nestled table (with all the non > image data) is not being displayed. It surprises me a great deal that putting xsl:apply-templates within the div doesn't work. Perhaps you could send the stylesheet that contains it and the source XML to me and I could have a look to find out what's going wrong. > Now it looks like: > > <br /><br /><div align="center"> > > <xsl:for-each select="/"> > <xsl:apply-templates select="book[@variant = 'Book' and @style = 'Fiction']" />> > <xsl:apply-templates select="book[@variant = 'Book' and @style = 'Non-Fiction']" />> > <xsl:apply-templates select="book[@variant = 'Graphic_Novel' and @style = 'Fiction']" />> > <xsl:apply-templates select="book[@variant = 'Magazine' and @style = 'Non-Fiction']" />> > </xsl:for-each> > > </div><br /><br /> > >> where at the moment you have a commented-out xsl:for-each. > ? I'm not sure what you're looking at... :) In the online stylesheet that I looked at, the xsl:for-each you show above was given within comments. As this is work in progress, no doubt the stylesheet is changing all the time. Anyway, the reason the above xsl:for-each doesn't work is that the xsl:for-each selects the root node to be the current node. Within the xsl:for-each, all the paths (selecting the books of various kinds) are relative to this current node. The book elements are not children of the root node, and therefore no book elements are selected. If you change the xsl:for-each to select the library element (which is the document element of your XML and holds the book elements) instead, i.e.: <xsl:for-each select="/library"> ... </xsl:for-each> then it will work. Unless there's something else wrong in your stylesheet, of course. > It could be that my concept is unworkable in XSL: I doubt that. From what I saw of your stylesheet, it looked fine aside from the obvious trouble that you're having selecting nodes properly. Wherever you have an XPath, you have to think about what the current node is and therefore what the path you use has to be relative from. This is your problem in the xsl:for-each and was your problem in the image_link template as well. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Nestled Template Surreali, Jeni Tennison | Thread | Re: [xsl] Count - Saxon & Xalan, David Carlisle |
RE: [xsl] Ext Func in XPath, Shruti Ahuja | Date | [xsl] is paging transformation on s, Elise D. |
Month |