[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

how to select attribute value based on another attribute value?


Subject: how to select attribute value based on another attribute value?
From: "Igor Nakshin" <inakshin@xxxxxxxxxxx>
Date: Wed, 12 Apr 2000 17:32:38 -0500

Hello,

Does anyone know how to select a value of an attribute of an element based
on a value of another attribute of
the same element?

Example

I have following XML document :

<RESULT>
- <ROW>
  <COLUMN NAME="CHARGES" VALUE="504.25" />
  <COLUMN NAME="COST" VALUE="273.36" />
  <COLUMN NAME="EXPREIMB" VALUE="458.86" />
  <COLUMN NAME="GROSSPROFIT" VALUE="230.89" />
  <COLUMN NAME="NETPROFIT" VALUE="185.5" />
  <COLUMN NAME="CASES" VALUE="1.0" />
  <COLUMN NAME="LOS" VALUE="1.0" />
  <COLUMN NAME="INLIER" VALUE="1.0" />
  <COLUMN NAME="OUTLIER" VALUE="0.0" />
  <COLUMN NAME="DRG_CODE" VALUE="274.0" />
  <COLUMN NAME="DRG_DESC" VALUE="Malignant breast disorders with CC" />
  </ROW>
  <ROW>
    ...
   </ROW>
</RESULT>

Using XSLT, how can I get to following HTML :

<TABLE>
<!-- for each <ROW> -->
<TR>
	<TD>
	<TABLE>
		<TR>
			<TD COLSPAN="8">
				<!-- value of COLUMN/@VALUE where COLUMN/@NAME = 'DRG_CODE' and
'DRG_DESC' should go here, e.g
				274.0 - Malignant breast disorders with CC
				 -->
			</TD>
		</TR>
		<TR> <!-- 8 columns -->
			<TD>
				<!-- value of COLUMN/@VALUE where COLUMN/@NAME = 'CHARGES'  e.g
$504.25 -->
			</TD>
			<TD>
				<!-- value of COLUMN/@VALUE where COLUMN/@NAME = 'COST'  e.g $273.36 -->
			</TD>

			... etc ...
		</TR>
	</TABLE>
	</TD>
</TR>
</TABLE>

Using Xalan 1.0 (if that makes any difference ;)

Thanks in advance,

Igor
inakshin@xxxxxxxxxxxxx






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



Current Thread
Keywords