[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: position() oddity?

Subject: Re: position() oddity?
From: Mike Brown <mike@xxxxxxxx>
Date: Wed, 28 Feb 2001 18:37:06 -0700 (MST)
Re:  position() oddity?
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.