|
Subject: Re: [xsl] getting associated file name for element From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 6 Mar 2002 22:44:11 +0000 |
Hi Matthew,
> If I am doing something like:
>
> <xsl:for-each select="document($all-questions//quiz/@href)//question">
> <xsl:sort order="ascending" select="faa-num"/>
> ...do stuff with each question...
> <xsl:value-of select="faa-num"/>
> Here's where I want to grab the name of the file, i.e. @href, the
> question came from
> </xsl:for-each>
>
> where quiz/@href contains the filenames containing questions to be
> grabbed and then sorted by a question child element called faa-num.
> How can I grab the value of @href as each question is evaluated?
Since you need to sort the questions, you can't. I think that the best
way to do what you're trying to do here is to create an intermediate
node tree and use a node-set() extension function to get at the nodes.
So something like:
<xsl:variable name="questions-rtf">
<xsl:for-each select="$all-questions//quiz/@href">
<quiz href="{.}">
<xsl:copy-of select="document(.)//question" />
</quiz>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="exsl:node-set($questions-rtf)/quiz/question">
<xsl:sort order="ascending" select="faa-num" />
... do stuff with each question ...
<xsl:value-of select="faa-num" />
...
<xsl:value-of select="../@href" />
</xsl:for-each>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] getting associated file name , Matthew L. Avizinis | Thread | Re: [xsl] getting associated file n, Gennady Loskutov |
| [xsl] inline call to external proce, Eric Smith | Date | Re: [xsl] inline call to external p, Thomas B. Passin |
| Month |