[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Problem getting position of node


Subject: RE: [xsl] Problem getting position of node
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 21 Mar 2006 14:58:34 +0530

Hi,
       Thanks to all who helped me on this. I get the idea now.

BTW, Iam using the saxon 6.5.4 processor.

cheers,
prakash








                                                                                                                                
                      "Michael Kay"                                                                                             
                      <mike@xxxxxxxxxx         To:      <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>                                       
                      om>                      cc:      (bcc: omprakash.v/Polaris)                                              
                                               Subject: RE: [xsl] Problem getting position of node                              
                      03/21/2006 02:52                                                                                          
                      PM                                                                                                        
                      Please respond                                                                                            
                      to xsl-list                                                                                               
                                                                                                                                
                                                                                                                                




> <xsl:template match="@*">
> <xsl:attribute name="{name(.)}">
> <xsl:value-of select="."/>
> <xsl:number count="*"/>
> </xsl:attribute>
> </xsl:template>
>
>
> As you can see, the context node is an attribute node and Iam
> getting the
> error,
>  Attribute nodes cannot be numbered.

Whichever processor is telling you that attributes cannot be numbered is
wrong. It doesn't make much sense to number them, but it's perfectly
permissible to do it, and the result is well defined.

However, if you're positioned on an attribute and you want the number of
the
parent element, in XSLT 2.0 you can do

<xsl:number select=".." count="*"/>

or in XSLT 1.0

<xsl:for-each select="..">
  <xsl:number count="*"/>
</xsl:for-each>


Michael Kay
http://www.saxonica.com/





POLARIS, THE LEADER IN SPECIALITY APPLICATION DEVELOPMENT :
-------------------------------------------------------------

Polaris has been awarded the Leader in the category of "Speciality Application Development" among the Top 100 global Companies from Cyber Media Publications for the Year 2006.

--------------------------------------------------------------

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in


Current Thread
Keywords