This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Reference to other node


Andrew Welch wrote:
<xsl:variable name="id-found"
select="generate-id(//GrilleSimple[local-name()=$name-to-find])"/>
Sorry Andrew,

but it should be

select="generate-id(//GrilleSimple[@Nom = $name-to-find])"

Alexandre,

it's maybe better to set up a key or at least to remove // from your XPATH:


<xsl:key name="gs" match="GrilleSimple" use="@Nom"/>

later in a template:
<xsl:variable name="id-found" select="generate-id(key('gs', $name-to-find))"/>

It does the same, but it's much faster, because the <GrilleSimple/>s are indexed and the file won't be searched every time.

Regards,

Joerg


-----Original Message-----
From: alexandre bord [mailto:alexandre.bord@steria.com]

How could i better do that ? :

<fo:block>
<xsl:variable name="id-found"><xsl:for-each select="//GrilleSimple[@Nom=$name-to-find]">
<xsl:value-of select="generate-id()"
/></xsl:for-each></xsl:variable>
This is on page <fo:page-number-citation ref-id="{$id-found}" />
</fo:block>


* name-to-find is a variable
* xsl:for-each returns only one node

Thanks a lot.
Alexandre

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]