Subject: Re: position() oddity?
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 28 Feb 2001 18:37:06 -0700 (MST)
|
Peter Flynn wrote:
> <headers>
> <title>First</title>
> <title>Second</title>
> <title>Third</title>
> <title>Fourth</title>
> <title>Fifth</title>
> </headers>
>
> what would you expect position() in template match "headers/title" to
> return? Currently it returns 2 4 6 8 10 using test.xsl (appended) when
> run through xt and cocoon. It's not quite what I expected (1 2 3 4 5 :-)
...
> <xsl:template match="headers">
> <tr>
> <xsl:apply-templates/>
> </tr>
> </xsl:template>
xsl:apply-templates sets the current node list to all the child nodes of
the current node. You apparently thought that the only children were the
'title' elements.
% saxon foo.xml ascii-treeview.xsl
root
|___processing instruction target='cocoon-process' instruction='type="xslt"'
|___processing instruction target='xml-stylesheet' instruction='href="test.xsl" type="text/xsl"'
|___element 'headers'
|___text '\n '
|___element 'title'
| |___text 'First'
|___text '\n '
|___element 'title'
| |___text 'Second'
|___text '\n '
|___element 'title'
| |___text 'Third'
|___text '\n '
|___element 'title'
| |___text 'Fourth'
|___text '\n '
|___element 'title'
| |___text 'Fifth'
|___text '\n'
- Mike
____________________________________________________________________
Mike J. Brown, software engineer at My XML/XSL resources:
webb.net in Denver, Colorado, USA http://skew.org/xml/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|
DPawson - Tue, 6 Feb 2001 07:16:56 -0500 (EST)
|
|