Re: [xsl] getting associated file name for element

Subject: Re: [xsl] getting associated file name for element
From: "Gennady Loskutov" <g_loskutov@xxxxxxxxxxxxx>
Date: Thu, 7 Mar 2002 14:16:26 +0100
> How can I grab the value of @href as each question is evaluated?

Matthew,

To determine URL of the file, where the current node is located, you can use
generate-id() function.
The root node for your current node must have the same id generated by
generate-id() function as the one generated for one of the root nodes of the
documents compiled together via document() function.

Therefore, you need to define a variable for the root node of the current
node:
<xsl:variable name="doc" select="generate-id(/)" />

and get the URL by:
 <xsl:value-of select="$all-questions//quiz[generate-id(document(@href)) =
$doc]/@href" />

Also, I suggest that you avoid using // operator if you know the path to
quiz elements beforehand - for example, selecting
"$all-questions/myquiz/quiz" is faster than "$all-questions//quiz" if
$all-questions contains other children than myquiz.

Regards,
Gennady


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


Current Thread