[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] generating ID strings that are both readable and unique
Subject: RE: [xsl] generating ID strings that are both readable and unique From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx> Date: Tue, 14 Oct 2008 21:23:51 +1300 |
Thanks David & 'Xmlizer', however I would prefer to avoid solutions based on either generate-id() or xsl:number. Ideally I would like to produce an output XML document which contains entries like <section id="introduction-1"><title>Introduction</title>...</section> ... <section id="examples"><title>Examples</title>...</section> ... <section id="introduction-2"><title>Introduction</title>...</section> ... and so on. I think I could probably manage to do this using keys in XSL 2.0 because I would be able to construct the key using the existing id attribute if there was one, or using the translated title child if there wasn't, and I could create an id attribute based on the number of identical keys. However this mechanism isn't possible in XSL 1.0, and unfortunately - because this stylesheet is to be invoked as part of Framemaker's save XML file logic - it has to be handled by the Xalan processor. Is there another approach? Cheers Trevor -----Original Message----- From: David Carlisle [mailto:davidc@xxxxxxxxx] Sent: Tuesday, 14 October 2008 9:04 p.m. To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] generating ID strings that are both readable and unique I tend to avoid generate-id() for this as it makes recreating the same ids if the source is edited (or even if it is not) very hard, which means people#s bookmarks get messed up if you regenerte. One fairly robust way is to go <xsl:attribute name="id"> <xsl:text>id.</xsl:text> <xsl:number count="*" level="multiple"/> </xsl:attribute/>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] generating ID strings tha, David Carlisle | Thread | Re: [xsl] generating ID strings tha, David Carlisle |
Re: [xsl] generating ID strings tha, David Carlisle | Date | Re: [xsl] generating ID strings tha, David Carlisle |
Month |