[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: getting associated file name for element

Subject: Re: getting associated file name for element
From: Corey_Haines@xxxxxxxxxxxxxxx
Date: Thu, 7 Mar 2002 09:23:21 -0500
quizz xsl
Could you do something like

<xsl:for-each select="$all-questions//quiz/@href" />
        <xsl:variable name='curDoc' select='.' />
        <xsl:for-each select="document($curDoc)//question">
        <xsl:sort order='ascending' select='faa-num' />
                <xsl:value-of select="faa-num" />
                <xsl:value-of select="$curDoc" />
        </xsl:for-each>

</xsl:for-each>

-Corey Haines





Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
03/06/2002 05:44 PM
Please respond to xsl-list

 
        To:     "Matthew L. Avizinis" <mla@xxxxxxxxx>
        cc:     xsl-list@xxxxxxxxxxxxxxxxxxxxxx, (bcc: Corey Haines)
        Subject:        Re:  getting associated file name for element



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




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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.