[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] key(), generate-id question
Dear list, I have az XML file with elements that may contain an attribute named _id. This element is defined as ID in the corresponding DTD. The XML file may containt elements without this attribute. In the output tree, I need to generate xmi.id attribute for each element, regardless of the existence of the _id attribute on the input side. On the input side I have _id attributes with values like: id000001, id000003, ... and so on. On the output side I need xmi.id attributes like: xmi.000001, xmi.000003 This line is fine when I have _id attributes for all elements: <xsl:attribute name="xmi.id"><xsl:choose><xsl:when test="@_id">xmi.<xsl:value-of select="substring-after(@_id,'id')"/></xsl:when><xsl:otherwise><xsl:value-of select="generate-id()"/></xsl:otherwise></xsl:choose></xsl:attribute> 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. Any ideas? Maybe I'm heading in the wrong direction? 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
|