xsl-list
[Top] [All Lists]

RE: [xsl] Problem getting position of node

2006-03-21 02:29:14





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(_at_)saxonica(_dot_)c         To:      
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>                              
         
                      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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--