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

context and conditional statement problem

Subject: context and conditional statement problem
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Tue, 7 Dec 2004 09:05:20 -0500
xsl conditional statement
I'm totally stumped. I've got a course syllabus document (and schema), which includes among other things this:

    <assignments>
      <assignment idref="breakfast" due="2004-01-19">
      </assignment>
      <assignment idref="econ-global" due="2004-02-03">
      </assignment>
      <assignment idref="tshirt-travels" due="2004-02-20">
      </assignment>
      <assignment idref="terror" due="2004-03-23">
      </assignment>
      <assignment idref="migrant-culture" due="2004-04-14">
      </assignment>
    </assignments>

These then point to a separate file, which has stuff like:

  <assignment id="econ-global">
    ...
  </assignment>

Sooo, I create a global variable to pull in these nodes:

<xsl:variable name="assignment-links" select="//assignment/@idref" />
<xsl:variable name="assignments-db" select="document('assignments.xml')" />
<xsl:variable name="assignments">
<assignments>
<xsl:for-each select="$assignment-links">
<xsl:copy-of select="$assignments-db/assignments/assignment[@id='{.}']" />
<test XXX="{.}"/>
</xsl:for-each>
</assignments>
</xsl:variable>


The conditional statement doesn't work. However -- and this is what I don't understand -- if I put in a valid value in place of the current '{.}', it does work. Similarly, note the test element correctly gets the id values from the other file:

           <h3 id="assignments">Assignments</h3>
            <ol></ol>
            <assignments>
               <test XXX="breakfast"></test>
               <test XXX="econ-global"></test>
               <test XXX="tshirt-travels"></test>
               <test XXX="terror"></test>
               <test XXX="migrant-culture"></test>
            </assignments>

Here's the template I use above (mostly to try to understand what's going on):

  <xsl:template match="assignments">
    <h3 id="assignments">Assignments</h3>
    <ol>
      <xsl:apply-templates select="$assignments/assignment"/>
    </ol>
    <xsl:copy-of select="$assignments" />
  </xsl:template>

Any ideas?

Bruce

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.