|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: key(), generate-id question
I'm resending this. Sorry if you got it twice, but I haven't got this mail back from the list-server. Thank you and appologize, Endre. ----- Original Message ----- From: "Endre Magyari" <endre@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Monday, November 11, 2002 9:29 AM Subject: Re: key(), generate-id question > > You can't control how generate-id() works, but you could do something > > like write a named template that will generate the ID. For example, you > > could count the number of preceding elements that don't have an _ID > > attribute and then add that value to the numeric part of the nearest > > preceding element that *does* have an _ID attribute. All doable with > > normal XSLT functions. > > > Based on this, as far as now I could do an enumeration of all the _id values > (as numbers) from the document, but I have no idea how to select the one > with the maximal value out of them. And Also, I have no idea how/where to > store the new id values being assigned. > The problem is that I've no experience with declarative languages. I can not > get used to the idea that a variable can not vary. What I would do is that > (if curr_value > max) max = curr_value. But how to do this here? Any help is > greatly appreciated. > > <!-- ID Generator--> > <xsl:template name="idgen"> > <xsl:for-each select="node()"> > <xsl:for-each select="@_id"> > <xsl:number value="substring-after(current(),'id')"/>; > </xsl:for-each> > </xsl:for-each> > </xsl:template> > > Thank you, > Endre > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








