xsl-list
[Top] [All Lists]

context and conditional statement problem

2004-12-07 07:05:20

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[(_at_)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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>