RE: [xsl] position() returns doubled result - what do i miss?

Subject: RE: [xsl] position() returns doubled result - what do i miss?
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Mon, 31 Mar 2003 09:25:40 +0100
It's been a couple of months since anyone asked this, so you can be
forgiven...

You are processing the whitespace text nodes in between the elements, as
well as the elements themselves. To process only the elements, use
<xsl:apply-templates select="*"/>

Then I noticed you had written:

<xsl:apply-templates match="root/item"/>

But <xsl:apply-templates> does not allow a "match" attribute, so any
conformant XSLT processor should have given you an error message. Which
processor are you using?

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of jian
> Sent: 31 March 2003 07:50
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] position() returns doubled result - what do i miss?
> 
> 
> i have :
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <root>
>       <item>item1</item>
>       <item>item2</item>
>       <item>item3</item>
>       <item>item4</item>
>       <item>item5</item>
>       <item>item6</item>
>       <item>item7</item>
>       <item>item8</item>
>       <item>item9</item>
> </root>
> 
> 
> 
> to which i apply:
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet 
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
> 
> <xsl:output method="html" version="4.01" encoding="UTF-8"/>
> 
>  <xsl:template match="/">
>    <xsl:apply-templates match="root/item"/>
>  </xsl:template>
> 
>  <xsl:template match="item">
>    <xsl:value-of select="position()"/>
>    <xsl:value-of select="."/>
>  </xsl:template>
> 
> </xsl:stylesheet>
> 
> 
> and for some reason i get :
> 
>       2item1
>       4item2
>       6item3
>       8item4
>       10item5
>       12item6
>       14item7
>       16item8
>       18item9
> 
> what do i miss?
> 
> jian
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread