I have a requirement like this.
<employee hireDate="09/01/1998">
<COLUMN NAME="LAST">Herbert three</COLUMN>
<COLUMN NAME="FIRST">Johnny</COLUMN>
<COLUMN NAME="ANL_RATE"><![CDATA[26525.8500]]></COLUMN>
<COLUMN NAME="STATUS"><![CDATA[A]]></COLUMN>
</employee>
another piece of XML is
<DESC_TABLE>
<COLUMN NAME="STATUS"><![CDATA[A]]></COLUMN>
<COLUMN NAME="DESCR"><![CDATA[Active]]></COLUMN>
</ROW>
</DESC_TABLE>
while reading STATUS (status A), I need to look up the
corresponding Description ('Active').
Assuming that the <employee> element is bound to variable $emp, and the
<DESC_TABLE> element to variable $table, and that there is a <ROW> start tag
carelessly omitted from the sample XML, you want
$table/ROW[COLUMN[(_at_)name='DESCR'][.=$emp/COLUMN[(_at_)name='STATUS']]/COLUMN[(_at_)NAME
='DESCR']
As I suggested in a response to a previous post, this would all become a lot
easier if you first transform this verbose representation of your data into
something cleaner, like
<statusCodes>
<status code="A" description="Active"/>
...
</statusCodes>
so the logic would become
$statusCodes/status[(_at_)code=$emp/status]/@description
Regards,
Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay
--~------------------------------------------------------------------
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>
--~--