This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: generating a repeatable unique id
On Mon, Jul 30, 2001 at 11:25:14AM +0100, Sebastian Rahtz wrote:
> Colin Muller writes:
>
> > If the doc hasn't changed, you could arrive at the same count during
> > your XSLT processing when the later request comes in
>
> OK, so I know I want "div-645" when I enter the document, so I do
>
> <xsl:apply-templates select="descendant::div[645]"/>
>
> but that sounds a bit expensive? I suppose I should trust the
> processor. can the select attribute be constructed with xsl:attribute?
I was thinking more along the lines of (please excuse any bum syntax
below - written in haste by a non-guru; the principle should be clear):
<xsl:template match="//div">
<xsl:variable name="seq"><xsl:number level="any" count="*"/></xsl:variable>
<xsl:if test="$seq=$param_passed_in">
<xsl:apply-templates select ="."/>
</xsl:if>
</xsl:template>
where param_passed_in was generated by:
<xsl:number level="any" count="*"/>
in the original document
I'm entirely unsure whether this would stress the processor - it's an
idea I haven't yet tried out.
Colin
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list