[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: key(), generate-id question

Subject: Re: key(), generate-id question
From: "W. Eliot Kimber" <eliot@xxxxxxxxxx>
Date: Sun, 10 Nov 2002 11:30:19 -0600
key generate
Endre Magyari wrote:
Dear list,

    The problem is that the generate-id() generates stg completely different
and I would like to generate an ID in the same form (xmi.number) with the
first/next available number. In order to achive this, I defined _id as a
key:

<xsl:key name="_id" match="node()" use="@_id"></xsl:key>


But I have no idea how to make the function generate-id() to generate the next available id from this key.

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.


Or you could implement a Java extension function that implements an ID generator that does what you want.

Cheers,

Eliot
--
W. Eliot Kimber, eliot@xxxxxxxxxx
Consultant, ISOGEN International

1016 La Posada Dr., Suite 240
Austin, TX  78752 Phone: 512.656.4139


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.