This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: How can I bend generate-id()?
- From: "Hunsberger, Peter" <Peter dot Hunsberger at stjude dot org>
- To: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Fri, 26 Jul 2002 15:53:03 -0500
- Subject: RE: [xsl] How can I bend generate-id()?
- Reply-to: xsl-list at lists dot mulberrytech dot com
>Is there some way in which I could "bend" generate-id() so as to produce
>two or more unique id's from the same context node?
Since the id will be unique for each invocation of the template why not just
append a constant to each generate? IE:
Here is the template and the output:
template
===================================================
<xsl:template match="node">
<xsl:param name="depth" select="0" />
<xsl:param name="tabSize" select="1" />
<div id="{generate-id()}_1" drag="enable"
style="position:relative;left:{$tabSize
* $depth}px;">
<xsl:variable name="level">
<xsl:value-of select="$depth + 1" />
</xsl:variable>
<xsl:if test="$depth != 0">
<img src="{$bulletURL}" id="{generate-id()}_2" />
</xsl:if>
<textarea id="{generate-id()}_3" class="editableNode" onfocus="Sink()"
onblur="Sink()">
<xsl:value-of select="normalize-space(text()[position()=1])" />
</textarea>
<xsl:apply-templates select="./*">
<xsl:with-param name="depth" select="$level" />
<xsl:with-param name="tabSize" select="$tabSize" />
</xsl:apply-templates>
</div>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list