This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Recursing on top-level elements


         <xsl:when test="/test/foo/@id=@id">

Thanks David, but this doesn't work for me - I still can't get the baz with
b_id="3" in red, since the match for /test/foo/@f_id is the foo with
f_id="1".

Example XML (well-formed):

<test>
   <foo f_id="1"/>
   <foo f_id="3"/>
   <bar>
      <baz b_id="1"/>
      <baz b_id="2"/>
      <baz b_id="3"/>
      <baz b_id="4"/>
   </bar>
</test>

My XSL:

<xsl:template match="/">
   <xsl:for-each select="test/bar/baz">
      <xsl:choose>
         <xsl:when test=".[@b_id = /test/foo/@f_id]">
            <!-- Do something, e.g. paint it red -->
         </xsl:when>
         <xsl:otherwise>
            <!-- Do something else -->
         </xsl:otherwise>
      </xsl:choose>
   </xsl:for-each>
</xsl:template>


Thanks,

/Jan



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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]