Subject: RE: [xsl] how to find position - please help From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Tue, 10 Dec 2002 09:27:01 -0000 |
> I need to find position of a node which I am selecting > using value of & a set of predicates... please help... really > sorry for asking probably a repeated and an easy question but > rite now deadline is here & after straight 13 hours I am a > bit fuzzy... so please help on this... regards, aruniima Perhaps when your mind has cleared you can explain to us what you mean by "the position of a node"? People sometimes use this phrase to mean "the number of preceding siblings plus one", which you can obtain as count(preceding-sibling::*)+1. Or use preceding-sibling::node() if you want to count non-element nodes. This is often confused with the position() function, which returns the position of the current node in the current node list. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > > <?xml version='1.0'?> > <xsl:stylesheet version="1.0" > > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > > xmlns:rs="urn:schemas-microsoft-com:rowset" > xmlns:z="#RowsetSchema"> > > > > <xsl:variable name="branch" > select="document('branchdata.xml',/*)/node()"/> > <xsl:template match="z:row"> > > <xsl:variable name="user_id" select="@COD_USER_ID"/> > <xsl:variable name="user_no" select="@COD_USERNO"/> > <xsl:variable name="cc_brn" select="@COD_CC_BRN"/> > <xsl:variable name="mnt_stat" select="@FLG_MNT_STATUS"/> > > <xsl:variable name="found_pos"> > <xsl:value-of > select="$branch//z:row[@COD_USER_ID=$user_id and > @CTR_USER_NO=$user_no and @COD_CC_BRN=$cc_brn and > @FLG_MNT_STATUS=$mnt_stat]/@COD_USER_ID"/> > </xsl:variable> > <xsl:if test="string-length($found_pos)=0"> > <xsl:value-of select="$user_id"/> > --- > <xsl:value-of select="$found_pos"/> > > <br/><br/> > </xsl:if> > </xsl:template> > > </xsl:stylesheet> > > Regards, > aruniima > > > > > > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] how to find position - pl, Vasu Chakkera | Thread | RE: [xsl] how to find position - pl, Rakesh Seth |
RE: [xsl] JAXP: namespaces/namespac, Michael Kay | Date | RE: [xsl] Identifying output from t, Michael Kay |
Month |