[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Increment a Value in xsl:for-each
Subject: RE: [xsl] Increment a Value in xsl:for-each From: "Michael Kay" <mhkay@xxxxxxxxxxxx> Date: Fri, 9 Mar 2001 10:52:54 -0000 |
> I am using xsl:for-each to read all the nodes with the > same name at the > same level in my xml file. > I have to actually read two nodes at one time. > > eg: > <Customer> > <Address/> > <Address/> > <Address/> > <Address/> > <City/> > <City/> > <City/> > <City/> > </Customer> > > In xsl:for-each I have to read first Address and First City > for the first > time, > Second Address and second City second time and so on. If you can't persuade someone to change this appalling data structure, try: <xsl:for-each select="Address"> <xsl:value-of select="Address"/> <xsl:variable name="p" select="position()"/> <xsl:value-of select=../City[$p]"/> </xsl:for-each> Don't even think of incrementing variables in XSLT: it's not a sequential, procedural language. Mike Kay Software AG XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Increment a Value in xsl:, David Carlisle | Thread | RE: [xsl] Substituting value in XML, Michael Kay |
RE: [xsl] Fatal error reported by X, Michael Kay | Date | RE: [xsl] How to "quo" without "quo, Michael Kay |
Month |
Keywords